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
Thanks a lot for reading!
Edit : Here’s a screen recording of how it’s going on my device -
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
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.
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:
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 :
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.
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?
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…
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 :
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…
@jane I am sorry but I cannot share the link of my project because it has some Payment Data and some sensitive information… 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)
Register screen - (submit button)
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.