pragmagic / godot-nim

Nim bindings for Godot Engine
https://pragmagic.github.io/godot-nim/
Other
500 stars 26 forks source link

Crashes in android #33

Closed DrMoriarty closed 6 years ago

DrMoriarty commented 6 years ago

Hello! I successfully built godot-nim-stub for android (my fork: https://github.com/DrMoriarty/godot-nim-stub) It starts and shows correct fps counter. But it crashes when I pressed the main scene. I added some debug output in https://github.com/DrMoriarty/godot-nim-stub/blob/master/src/mainpanel.nim so log is:

06-27 00:22:28.057: D/GODOT(632): ** GODOT ACTIVITY CREATED HERE ***
06-27 00:22:28.077: D/AccessibilityManager(632): current package=org.godotengine.godotnimstub, accessibility manager mIsFinalEnabled=false, mOptimizeEnabled=true, mIsUiAutomationEnabled=false, mIsInterestedPackage=false
06-27 00:22:28.398: D/GODOT(632): command_line is null? no
06-27 00:22:28.447: I/godot(632): **INIT EVENT! - 0xf3e19310
06-27 00:22:28.447: I/godot(632): ***************** HELLO FROM JNI!!!!!!!!
06-27 00:22:28.447: I/godot(632): *******CLASS FOUND!!!
06-27 00:22:28.447: I/godot(632): STEP2, 0x10096e
06-27 00:22:28.447: I/godot(632): STEP3 -410202076
06-27 00:22:28.447: I/godot(632): STEP4, 0x20001d
06-27 00:22:28.447: I/godot(632): STEP4.5, 0x100972
06-27 00:22:28.448: I/godot(632): STEP7
06-27 00:22:28.448: I/godot(632): STEP8
06-27 00:22:28.448: I/godot(632): *******GOT METHOD _dir_open ok!!
06-27 00:22:28.448: I/godot(632): *******GOT METHOD _dir_next ok!!
06-27 00:22:28.448: I/godot(632): *******GOT METHOD _dir_close ok!!
06-27 00:22:28.448: I/godot(632): *******GOT METHOD _dir_is_dir ok!!
06-27 00:22:28.448: I/godot(632): starting to attempt get methods
06-27 00:22:28.448: I/godot(632): *******GOT METHOD _init_audio ok!!
06-27 00:22:28.448: I/godot(632): *******GOT METHOD _write_buffer ok!!
06-27 00:22:28.448: I/godot(632): *******GOT METHOD _quit ok!!
06-27 00:22:28.448: I/godot(632): *******GOT METHOD _pause ok!!
06-27 00:22:28.448: I/godot(632): test construction 5
06-27 00:22:28.448: I/godot(632): running from dir /
06-27 00:22:28.466: I/godot(632): **SETUP
06-27 00:22:28.466: I/godot(632): CMDLINE LEN 2 - APK EXPANSION 0
06-27 00:22:28.507: I/godot(632): *****SETUP OK
06-27 00:22:28.507: I/godot(632): ANDROID MODULES: Nothing to load, aborting
06-27 00:22:28.517: I/godot(632): WARNING: not found: display/driver/keep_screen_on
06-27 00:22:28.543: D/GODOT(632): setVirtualKeyboardHeight: 0
06-27 00:22:28.548: I/Adreno(632): QUALCOMM build                   : 53b4b64, I83a540a04a
06-27 00:22:28.548: I/Adreno(632): Build Date                       : 09/18/17
06-27 00:22:28.548: I/Adreno(632): OpenGL ES Shader Compiler Version: XE031.09.00.04
06-27 00:22:28.548: I/Adreno(632): Local Branch                     : 
06-27 00:22:28.548: I/Adreno(632): Remote Branch                    : quic/gfx-adreno.lnx.1.0.r5-rel
06-27 00:22:28.548: I/Adreno(632): Remote Branch                    : NONE
06-27 00:22:28.548: I/Adreno(632): Reconstruct Branch               : NOTHING
06-27 00:22:28.669: I/OpenGLRenderer(632): Initialized EGL, version 1.4
06-27 00:22:28.669: D/OpenGLRenderer(632): Swap behavior 1
06-27 00:22:28.672: W/GodotView(632): creating OpenGL ES 3.0 context :
06-27 00:22:28.684: I/godot(632): ^_^_^_^_^ newcontext 0
06-27 00:22:28.684: I/godot(632): ^_^_^_^_^ resize 0, 1440, 720
06-27 00:22:28.685: I/godot(632): **FIRST_STEP
06-27 00:22:28.697: I/godot(632): OpenGL ES 3.0 Renderer: Adreno (TM) 506
06-27 00:22:28.749: I/godot(632): OpenSL Init OK!
06-27 00:22:28.754: I/libOpenSLES(632): Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
06-27 00:22:28.766: W/AudioTrack(632): AUDIO_OUTPUT_FLAG_FAST denied by client; transfer 1, track 44100 Hz, output 48000 Hz
06-27 00:22:28.769: D/AudioTrack(632): Client defaulted notificationFrames to 590 for frameCount 1772
06-27 00:22:29.072: I/Choreographer(632): Skipped 32 frames!  The application may be doing too much work on its main thread.
06-27 00:22:29.273: I/godot(632): Main panel is ready
06-27 00:22:30.679: D/GODOT(632): setVirtualKeyboardHeight: 0
06-27 00:22:42.508: V/BoostFramework(632): BoostFramework() : mPerf = com.qualcomm.qti.Performance@619cbc6
06-27 00:22:42.519: I/godot(632): Main panel have input
06-27 00:22:42.519: I/godot(632): Main panel have mouse pressed
06-27 00:22:42.519: I/godot(632): Main panel have left mouse button pressed
06-27 00:22:42.541: I/godot(632): We are changed the scene
06-27 00:22:46.179: E/godot(632): **ERROR**: Unhandled exception: Error: unhandled exception:  [NilAccessError]
06-27 00:22:46.179: E/godot(632):    At: /Users/vasya/.nimble/pkgs/godot-0.7.14/nim/godotnim.nim:838:() - Unhandled exception: Error: unhandled exception:  [NilAccessError]
06-27 00:22:46.179: E/godot(632): **ERROR**: Unhandled exception: Error: unhandled exception:  [NilAccessError]
06-27 00:22:46.179: E/godot(632):    At: /Users/vasya/.nimble/pkgs/godot-0.7.14/nim/godotnim.nim:838:() - Unhandled exception: Error: unhandled exception:  [NilAccessError]

The last two lines repeated more than 100 times and then application closes. I tried to change compilation flags. I disabled threads and tlsEmulation but it have absolutely no effect.

Also I changed android compilation from clang to gcc because of errors (https://forum.nim-lang.org/t/3981) I don't know if it affect to this issue.

Macosx: 10.13.4 Godot: 3.0.4 Android: 7.1.2 Android NDK: r14b

DrMoriarty commented 6 years ago

I checked the ios exporting and the application run successfully. Scene was loaded without any errors, but after loading I see a lot of 502 errors in xcode console:

2018-06-27 12:05:28.357561+0300 Godot-Nim-Stub[2867:5743374] 502 error
2018-06-27 12:05:28.378690+0300 Godot-Nim-Stub[2867:5743374] 502 error
2018-06-27 12:05:28.387347+0300 Godot-Nim-Stub[2867:5743374] 502 error
2018-06-27 12:05:28.404656+0300 Godot-Nim-Stub[2867:5743374] 502 error

It appears many times per second. I think that something gets wrong gateway error but have no idea what part of code is it.

endragor commented 6 years ago

godot-nim does work both on iOS and Android and here is a game in production built with it: https://www.summonage.com/

This issue should've been filed in godot-nim-stub repo. That project's build scripts should be extended to properly support mobile.

502 error is printed for any Godot game on iOS, not sure where it comes from, but it's not related to godot-nim.

Android's NilAccessError likely also comes from Godot, since there is no Nim stack trace. Remove import segfaults from the project and you'll have a native crash tombstone that you can investigate.

DrMoriarty commented 6 years ago

You are right! I commended out importing segfaults module and it shows me the root of problem:

06-27 14:46:50.111: E/godot(18164): **ERROR**: Condition ' _first != __null ' is true.
06-27 14:46:50.111: E/godot(18164):    At: core/self_list.h:100:~List() - Condition ' _first != __null ' is true.
JohnAD commented 6 years ago

Possibly way off-topic; but not maybe. The example game of summonage you linked to appears to be incompatible, per the Play Store, with all my devices. From an old Nexus 5 to a Google Pixel XL running the latest Android version. Do you think this a setting in GoDot or something messed up at the Play store?

DrMoriarty commented 6 years ago

@JohnAD I installed and played summonage on my Redmi 5 successfully. It have Android 7.1.2.

ghost commented 6 years ago

@JohnAD it's compatible with my Redmi 4 Prime with custom ROM with Android 8.1

JohnAD commented 6 years ago

I just figured it out. I next went to the Play Store on the Pixel XL device. Could not find the app; which makes sense since it is not available for it. So, I then went to the web site and followed the link, which forced the Play store to show the entry. It says "This item isn't available in your country." which is much more descriptive.

So, not a problem. It is simply not available in the US.

Just FYI:

My Pixel XL is running Android 8.1.0. Screenshot from web: https://www.dropbox.com/s/atta7i6fnf9m9fs/summonage_screenshot.png?dl=0