# Best practices to avoid crash on android

**URL:** <https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980>\
**Category:** Questions about Thunkable X\
**Created:** [August 29, 2018, 8:11pm UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980 "2018-08-29T20:11:58Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Claus\_Holbech](https://avatars.discourse-cdn.com/v4/letter/c/82dd89/32.png) [@Claus\_Holbech](https://community.thunkable.com/u/Claus_Holbech)\
**Post date:** [August 29, 2018, 8:11pm UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/1 "2018-08-29T20:11:58Z")

</div>

I have many problems with apps that works fine on IoS, but keeps crashing on Android at load.

Is there some best practices on what to do / not to do, to make sure that it will work on both platforms?.

---

<div class="post-metadata">

**Author:** ![albert](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/albert/32/4077_2.png) [@albert](https://community.thunkable.com/u/albert)\
**Post date:** [August 29, 2018, 11:53pm UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/2 "2018-08-29T23:53:37Z")

</div>

We have a few issues documented on our [troubleshooting page](https://docs.thunkable.com/thunkable-cross-platform/troubleshooting#live-test-android) but we’re curious to know the other issues users are facing.

Albert

---

<div class="post-metadata">

**Author:** ![Claus\_Holbech](https://avatars.discourse-cdn.com/v4/letter/c/82dd89/32.png) [@Claus\_Holbech](https://community.thunkable.com/u/Claus_Holbech)\
**Post date:** [August 30, 2018, 12:37pm UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/3 "2018-08-30T12:37:04Z")

</div>

Hi Albert  
I have tried to check thet troubleshooting page, but that did not solve it.

I have tried alot more today, and have found out that every page needs a open and a start block (Even it they don’t do anything).  
Adding that solved many crashes on my pages.

At the moment it only seems to crash on anything related to maps markes or positions if configured via a block. (I thought you solved that. ?.).

Is there a way to solve this at the moment?.

---

<div class="post-metadata">

**Author:** ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)\
**Post date:** [August 31, 2018, 8:45pm UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/4 "2018-08-31T20:45:18Z")

</div>

Claus,

Is there any chance that you could share with us a simple app that crashes without a start and open block but works with them defined and empty? That might help us a lot in diagnosing the problem!

Thanks in advance.

-Mark

---

<div class="post-metadata">

**Author:** ![Basak\_Uludag](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@Basak\_Uludag](https://community.thunkable.com/u/Basak_Uludag)\
**Post date:** [September 1, 2018, 9:51am UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/5 "2018-09-01T09:51:06Z")

</div>

Hi Mark,

I also have problems with the android app. It crashes when the app is loading, which is not an issue on the iOS. I tried to make a simple app but it did not crash there. How can I show you my app? Could you help me with that?

(My app includes tab navigator with 3 screens, Webviewer, share, local DB, buttons, List\_viewers.)

I am looking forward to your response.

Cheers,  
Serdar

---

<div class="post-metadata">

**Author:** ![Claus\_Holbech](https://avatars.discourse-cdn.com/v4/letter/c/82dd89/32.png) [@Claus\_Holbech](https://community.thunkable.com/u/Claus_Holbech)\
**Post date:** [September 1, 2018, 7:01pm UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/6 "2018-09-01T19:01:23Z")

</div>

I have tried to reproduce it in a new simple app, but for some reason, that works fine.

Maybe it is some combination with other pages. I will keep testing, to see what causes the crash.

What about the map component, is there any hope to get that to work on Android?.

Claus

---

<div class="post-metadata">

**Author:** ![Rob\_Schoemaker](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/rob_schoemaker/32/21023_2.png) [@Rob\_Schoemaker](https://community.thunkable.com/u/Rob_Schoemaker)\
**Post date:** [September 1, 2018, 8:02pm UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/7 "2018-09-01T20:02:00Z")

</div>

Same here. My app works fine on IOS, but crashes immediately on Android (Genymotion emulator).  
In the log, the following message shows up, maybe that is a clue?

![2018-09-01%2021_52_00-Window](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/9/29942950fbeb3429ca6c347271a75bf961961271.png)

@Mark also willing to share my app, if that is helpful for you. Just let me know if you are interested.

Regards  
Rob

---

<div class="post-metadata">

**Author:** ![Claus\_Holbech](https://avatars.discourse-cdn.com/v4/letter/c/82dd89/32.png) [@Claus\_Holbech](https://community.thunkable.com/u/Claus_Holbech)\
**Post date:** [September 1, 2018, 8:20pm UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/8 "2018-09-01T20:20:45Z")

</div>

How do you get a log output?..

Claus

---

<div class="post-metadata">

**Author:** ![Rob\_Schoemaker](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/rob_schoemaker/32/21023_2.png) [@Rob\_Schoemaker](https://community.thunkable.com/u/Rob_Schoemaker)\
**Post date:** [September 1, 2018, 8:30pm UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/9 "2018-09-01T20:30:28Z")

</div>

When the app crashes, I get a screen with a button “show log”. 😉  
Don’t know if that is Genymotion specific or normal Android.

Regards Rob

---

<div class="post-metadata">

**Author:** ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)\
**Post date:** [September 1, 2018, 10:41pm UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/10 "2018-09-01T22:41:32Z")

</div>

> [@Claus\_Holbech](#):
>
> I have tried to reproduce it in a new simple app, but for some reason, that works fine.
> 
> Maybe it is some combination with other pages. I will keep testing, to see what causes the crash.

Thanks, Claus. Let us know what you find!

> [@](#):
>
> What about the map component, is there any hope to get that to work on Android?.

We were not aware of the map component not working on Android. Would you please file a bug [here](https://github.com/thunkable/thunkable-issues/issues/new/choose) about that.

-Mark

---

<div class="post-metadata">

**Author:** ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)\
**Post date:** [September 1, 2018, 10:43pm UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/11 "2018-09-01T22:43:39Z")

</div>

Thanks, @Rob_Schoemaker! If you can share a relatively simple app that demonstrates the problem it would be very helpful. Unfortunately the error message that you mentioned is pretty generic and not all that helpful ☹

-Mark

---

<div class="post-metadata">

**Author:** ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)\
**Post date:** [September 1, 2018, 10:46pm UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/12 "2018-09-01T22:46:09Z")

</div>

> [@Basak\_Uludag](#):
>
> How can I show you my app? Could you help me with that?

Serdar, [Here are the instructions](https://docs.thunkable.com/thunkable-cross-platform/share) for sharing your app. If it’s possible to simplify your app and still have it crash, that would be most useful.

-Mark

---

<div class="post-metadata">

**Author:** ![Basak\_Uludag](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@Basak\_Uludag](https://community.thunkable.com/u/Basak_Uludag)\
**Post date:** [September 2, 2018, 11:08am UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/13 "2018-09-02T11:08:08Z")

</div>

Hi Mark,

Thank you. I just removed the simplest screen and added again and it worked out just by luck and I cannot reproduce the crash anymore. 🙂

Serdar

---

<div class="post-metadata">

**Author:** ![Claus\_Holbech](https://avatars.discourse-cdn.com/v4/letter/c/82dd89/32.png) [@Claus\_Holbech](https://community.thunkable.com/u/Claus_Holbech)\
**Post date:** [September 2, 2018, 7:10pm UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/14 "2018-09-02T19:10:13Z")

</div>

I will do that…

This block will crash the android app every time.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/f/af36ce509cef9f7d875a0f7321e04bae6cefd585.png)

---

<div class="post-metadata">

**Author:** ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)\
**Post date:** [September 2, 2018, 10:47pm UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/15 "2018-09-02T22:47:28Z")

</div>

@Claus_Holbech, Can you try passing numbers instead of strings to the `Add Marker` block and let me know if that works?

---

<div class="post-metadata">

**Author:** ![Rob\_Schoemaker](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/rob_schoemaker/32/21023_2.png) [@Rob\_Schoemaker](https://community.thunkable.com/u/Rob_Schoemaker)\
**Post date:** [September 3, 2018, 1:27pm UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/16 "2018-09-03T13:27:31Z")

</div>

Mark,

This is a stripped version of my app (only the first two screens). Also, of course the Firebase calls don’t work anymore, but still this version works on IOS and crashes on Android (immediately after launch, even before it switches to the second screen). Hope this helps for identifying the issue.

[https://x.thunkable.com/copy/5df52d25397baf820f5ae97fe0f8836e](https://x.thunkable.com/copy/5df52d25397baf820f5ae97fe0f8836e)

Regards Rob

---

<div class="post-metadata">

**Author:** ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)\
**Post date:** [September 3, 2018, 6:25pm UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/17 "2018-09-03T18:25:22Z")

</div>

> [@Rob\_Schoemaker](#):
>
> This is a stripped version of my app

Thanks, Rob. We’ll take a look.

-Mark

---

<div class="post-metadata">

**Author:** ![Claus\_Holbech](https://avatars.discourse-cdn.com/v4/letter/c/82dd89/32.png) [@Claus\_Holbech](https://community.thunkable.com/u/Claus_Holbech)\
**Post date:** [September 3, 2018, 7:41pm UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/18 "2018-09-03T19:41:56Z")

</div>

Thanks… In my project, I had qouted my lat and long values in the json output.  
Removing those solved the crashes on android.

Claus

---

<div class="post-metadata">

**Author:** ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)\
**Post date:** [September 4, 2018, 4:26pm UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/19 "2018-09-04T16:26:39Z")

</div>

> [@Claus\_Holbech](#):
>
> Thanks… In my project, I had qouted my lat and long values in the json output.  
> Removing those solved the crashes on android.

Yes, that is what I meant when i said to “try passing numbers instead of strings” in my reply above. Great to hear that your crashes were solved!

-Mark

---

<div class="post-metadata">

**Author:** ![Rob\_Schoemaker](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/rob_schoemaker/32/21023_2.png) [@Rob\_Schoemaker](https://community.thunkable.com/u/Rob_Schoemaker)\
**Post date:** [September 6, 2018, 8:07am UTC](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980/20 "2018-09-06T08:07:52Z")

</div>

Hi @Mark  
Just to let you know that it occured to me that maybe the issue was caused because the local storage blocks are executed async and maybe I created some kind of race condition by first writing and immediately reading from local storage (write not finished at the moment i read). So I changed my blocks as follows:

 ![2018-09-06%2009_56_21-Thunkable](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/3/23cd37d615233865de50cb9fa33a4d59e068ed00.png)

However, the Android version still crashes. (same error message as reported before)

Regards Rob

BTW: Just to clarify: I write the value and read immediately as a temporary “quick and dirty” fix: the current version of the app is just for one team, but in the future i want to extend that to multiple teams. So the idea is that if “teamid” does not exist, the user will be presented a screen to select the team, which is then stored in local storage. All the other screens use the teamid to load the correct data from firebase. So for now, I just write the team hard-coded.

[Next page](https://community.thunkable.com/t/best-practices-to-avoid-crash-on-android/43980.md?page=2)
