android json error

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Bush2Tree

Hey all,

I have a game which loads json data files, which are located under res://. When debugging on my computer (windows), it handles this completely fine. However, when I attempt to run the game on android, it crashes. Using the android emulator and adb logcat, i get the following:

godot   : **ERROR**: File must be opened before use.
godot   :    At: core/bind/core_bind.cpp:2023:get_as_text() - Condition "!f" is true. Returned: String()
godot   : **ERROR**: Error parsing JSON at line 0:
godot   :    At: core/bind/core_bind.cpp:3220:parse() - Error parsing JSON at line 0:
godot   : **ERROR**: File must be opened before use.
godot   :    At: core/bind/core_bind.cpp:2023:get_as_text() - Condition "!f" is true. Returned: String()
godot   : **ERROR**: Error parsing JSON at line 0:
godot   :    At: core/bind/core_bind.cpp:3220:parse() - Error parsing JSON at line 0:
godot   : **ERROR**: File must be opened before use.
godot   :    At: core/bind/core_bind.cpp:2023:get_as_text() - Condition "!f" is true. Returned: String()
godot   : **ERROR**: Error parsing JSON at line 0:
otengine.gamen: System.exit called, status: 0
AndroidRuntime: VM exiting with result code 0, cleanup skipped.

It’s most likely irrelevant, but the error repeated itself a lot more times than I included–I just stripped out most of the repetitions for brevity’s sake.

After searching up similar problems with android, apparently the difference between case-insensitive filepaths in windows and case-sensitive filepaths in android is the primary cause of android crashes. However, I am nearly certain that all of my filepaths are correct, and the error messages (at least to me), don’t seem to point towards a filepath issue.

Does anybody know what else might be causing this issue? Any help is appreciated.

Windows 10 Home 1903
Godot 3.2.1 Stable

Did you specify *.json in the non-resource export filter in the Android export preset?

Calinou | 2020-05-11 08:51

I didn’t, everything works perfectly after adding *.json and *.txt to my non-resource export filter. Thanks a lot!

Bush2Tree | 2020-05-11 17:37