Android crash on loading scene

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Scayze
:warning: Old Version Published before Godot 3 was released.

Hey everyone!
My game runs perfectly fine on windows, but it immediatly crashes when i try to load the main scene from a “play” button. The button worked before. I just made some small changes in the code, which i dont remember correctly, and suddenly it stops working correctly on my phone. How does that happen? what could be the reason? and is there a way to debug the android application remotely from the PC? Or is there a logfile for android? im helpless, i cant figure out why that happens. any ideas?

EDIT: it doesnt actually crash. The app freezes for a second or so, and then nothing happens and i remain in the scene with the “play” button

:bust_in_silhouette: Reply From: garred

Yeah, I had a similar problem (well, my app doesn’t freezed, but crashes).

I don’t know how to debug from PC (like being able to see in what line of code the error is) but you can use print() function to see what your program is doing. It is suppose to print the text in the Output window in the Godot Editor.

I have to recommend to you to update you Android system, that is what fixed my problem. I just realized that my app worked without problem on other smartphone, and in the end it was that my Android version was outdated.

Another point is to use the program monitor in the Android Sdk (in my computer with Linux is inside /home/Android/Sdk/tools/monitor), that lets you to receive a lot of messages and info about normal and abnormal program functioning in your smartphone. You have to filter all the messages by setting a new filter “by Application Name: godotengine” to be able to see the needle in the haystack.

I hope something of this can help you. Good luck.

EDIT: For example, I just solved a problem I had right now similar to yours (with freezing splash screen) using the monitor. In it, I saw lots of error messages, but some were related to errors loading resources. In the end what happened is that I had a path to a resource in a preload like “/dart/dart.tscn”, and it worked fine in PC but not in Android, where it must be “res://dart/dart.tscn”. Without the monitor I never would found this error.

in windows is located under:
Program Files\Android\android-sdk\tools\monitor.bat

MrMonk | 2016-11-05 10:02

Ok thank you!
Gotta upgrade my android then i guess.
My paths’ are all fine, never ever used a path without “res://”. Only with get_node(). is it required in that method too?

also, thanks for pointing out the SDK monitor, seems to be really helpfull, even though i didnt get much out of it, it seems like godot has troubles loading .gd scripts and/or byte codes. The log is here if you are intereseted Godot andoird monitor log - Pastebin.com
if you have any idea to fix it, id be really grateful!

Scayze | 2016-11-05 18:11

seems to be a recurring error:
Failed loading resource: res://Scripts/PowerUpButtons.gd
have you checked on that ?

MrMonk | 2016-11-05 19:18

I think is not necessary to put “res://” in “get_node”.

I see an error like

Can’t preload resource at path: res://Objects/shield.tscn

It seems like you are using a preload(‘res://Objects/shield.tscn’) function anywhere. I’m not sure if that’s the problem, but in Android paths are case sensitive while Windows is case insensitive. Could you check if the paths are well written?

garred | 2016-11-05 19:42

Thanky you sooo much everyone! i knew android path’s were sensitive but i didnt know it mattered that i wrote “shield.tscn” instead of “Shield.tscn” with a capital ‘S’. Now i feel kinda dumb about that. Whatever! im happy i found the mistakes with your help! Have a great day!

Scayze | 2016-11-05 20:02

Glad to hear that it is fixed :wink: Have a nice day too.

garred | 2016-11-06 18:35

I just registered on this board to tell you that your hint with the monitor is worth its weight in gold, even in 2021. Thank you so much!

kesslmar | 2021-01-25 23:48

Wow thanks, you’re very kind :slight_smile:

garred | 2021-01-25 23:58