App keeps crashing on Android APK & Live

Hi there, I hope you are doing good! :wave:

I’ve been experiencing this for 3-4 days, that my app is crashing suddenly on my Android device on both Live & APK… The app I think is crashing on 3 moments -

  • ‘Login’ screen - which has a button which on click should lead to ‘Register’ screen & when it’s clicked app crashes
    • If somehow Register screen gets opened, and I try to go back to my Login screen, it crashes.
  • Register screen - it also has a submit button which on click should lead to ‘Payment’ screen - but when I click it, the app stops for a second, and then crashes.
  • Payment screen - when I try to go back from payment screen to register screen (just like case #2, it crashes)

The above crashes do NOT happen on every screen of my app - only the above listed screens are showing these them…

What is happening? I even checked and re-built my code, but nothing’s changing… The app crashes on basic commands like navigate to & go back

Please help :persevere:
Thanks a lot for reading!

Edit : Here’s a screen recording of how it’s going on my device -

1 Like

Hi @kartik14, do you have DataViewers in those screens? Do these screen include a refresh block?

Nope, not on any of those 3 screens…

I have a similar issue on Android APK and Live - does it happen all the time you click on the button or when you click reset then it works?

I have debugged the issue I encounter and it seems related to the DV refresh block. Maybe someone can help.

1 Like

Thunkable tends to crash when asked to do something “impossible”, for instance if a variable is null but you’re trying to use it, or if you’re trying to add 1 to a string, or get a property from an object that doesn’t exist, or a list item from something that’s not a list. I’d look at the “when screen starts” blocks for the screens that you’re trying to navigate TO when the crash happens. That’s probably where the problem is, not the ‘navigate’ itself.

You can test that by disconnecting ALL the blocks under “when screen starts” for the problem screen(s). If the crashing stops, you’ll know where to look. Then either insert a ‘vibrate’ block at points in the code - if the phone vibrates, you know the problem is further on. Or disconnect blocks starting at the bottom until it quits crashing. Then you’ll know where the problem is. Either way, localize the problem

5 Likes

Thanks for the advice, @catsarisky! Really helpful. I’ll try it ASAP.

Also, I’ve just added/appended a screen recording of the app crashing in the first post- please have a look at it too… :slightly_smiling_face:

Thanks!

Hi, @catsarisky,

I tried adding the vibrate block at some checkpoints, and everything works perfect until the end of the code. Here’s the thing - (below blocks snippet is from the submit button from my register screen)

When I run the above blocks, at the end my phone vibrates (which means my code is working perfectly). But as soon as I add the navigate block below the disable button block, the app crashes. Which means, that the navigate block is causing problems. Just to clarify, the Pay screen is an empty screen - it doesn’t have any components or blocks.

Any ideas? Thanks!

Edit : Here’s an update -

  • When the navigate to screen is changed to any other screen (except Login & Pay), it works; else it won’t. Which means the navigate block is working if the screen selected is different
  • But unfortunately, I cannot try re-building the defective screens because I have 150+ components & 400+ blocks on both Login & Register… (just the Pay screen is empty)
  • Also, it doesn’t matter if I place the navigate to block somewhere else - it crashes everywhere, when any of the defective screens are selected.
1 Like

Create a new screen and name it “Pay Test” or even use the default name and test if it goes ok.

If the app doesn’t crash just delete the “Pay” screen and rename the newly created screen.

2 Likes

Hi, @muneer :wave:

First of all, thanks for replying! I tried the idea you suggested but turns out that even if I create new screens (temporary replacements for Login & Pay screens) named login2 & payment2, the app still crashes.


Here’s the workflow of my app :

  • The login screen is opened the very first time user opens the app. If you want to login into the app, you can fill up your mobile no. and login (process complete here). But, if you don’t have an account, you can register by clicking the ‘Register as a new Member’ button.

    • Here, when I click the Register button, it should open the ‘Register’ screen. But instead, the app crashes. Here’s the code of the Register button on login2 screen:

      image

  • Now on the Register screen, you can do two things: either fill up the form and make your payment by clicking the submit button (which opens the Pay screen), or go back to login screen by clicking your device’s default back button.

    • Here, the app crashes on both tasks. When I try to go back & when I fill-up the form and click submit. Here is the code of when back-button-pressed & submit button :

      image

      image

Note : the login2 & payment2 are new blank screens I just created to test if they still cause problems.

As simple as the blocks might seem, eventually they end up crashing the app. And even if I do not add the back-pressed block in register screen, it still crashes.

Any ideas on this? Thanks a lot!

1 Like

Can you test something.

Add a new button and use it to navigate to registration screen instead of the existing one. Use the new button with default name or a new name you know has not been used in the app.

Will it open the registration screen or will it still crash?

1 Like

Thanks!

image

It works, but the screen stops for a second and then suddenly opens the Register screen. So I tried adding a wait block - and it seems workable now. But, it still doesn’t work sometimes - like it’s crashing every 1 in 5 times…

1 Like

Is the screen you’re going to in a navigator? If so, try navigating to the navigator instead of the screen.

2 Likes

Nope, it’s in open… All 3 of them…

@domhnallohanlon Any ideas?

1 Like

Here’s another update :

I thought that there might be a problem with the back-button-pressed block, so I replaced the navigate to block with something else to check it :

image

Here the label displays the random numbers perfectly… Turns out, as earlier the problem lies with the navigate to block. I tried re-building my Register screen from scratch, but new re-built screen also shows the same errors with the navigate block.

Wherever there’s a navigate block in a newly created screen, my app would crash. All the other blocks & all the other screens are working perfectly…

@domhnallohanlon @jane Do you mind giving any ideas? Thanks!


Edit : Also raised this issue on GitHub : 'Navigate to' block crashes app everytime when executed · Issue #935 · thunkable/thunkable-issues · GitHub

1 Like

Can you share a link to a project that demonstrates this behavior?

1 Like

@jane I am sorry but I cannot share the link of my project because it has some Payment Data and some sensitive information… :expressionless: So Sorry for that…

But I can share my blocks if they would help : (just the navigate to block isn’t working - the button and the rest of the code are working perfectly.)

Login screen - (go to register screen button)

image

Register screen - (submit button)

image

I haven’t added a back-button-pressed block in Register & payment2 because even if I don’t add one, it should go back but the app’s crashing there too.

1 Like

Can you create a project that does not contain sensitive data, but does demonstrate this behavior?

2 Likes

@jane Sure! I’ll revert to you in PMs with my basic project in a few minutes. Thanks!

2 Likes

Thanks!

1 Like

@jane just PM’d you the link. Sorry for the delay…

Please have a look at it :slightly_smiling_face: Thanks!

1 Like