+1 vote

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

asked Nov 4, 2016 in Engine by Scayze (25 points)

1 Answer

+1 vote
Best answer

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.

answered Nov 4, 2016 by garred (102 points)
selected Nov 5, 2016 by Scayze

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

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 http://pastebin.com/gzRXaeJX
if you have any idea to fix it, id be really grateful!

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

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?

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!

Glad to hear that it is fixed ;) Have a nice day too.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.