2

My NDK game works well in Debug mode, but crashes in release with the following log on Nexus 7:

E dalvikvm: dlopen("/data/app-lib/com.js.pathoflight-1/libPathOfLight.so") failed: dlopen failed: cannot locate symbol "__gnu_thumb1_case_uqi" referenced by 
"libPathOfLight.so"...  
W dalvikvm: Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/js  /pathoflight/JSNativeActivity;  
W dalvikvm: Class init failed in newInstance call (Lcom/js/pathoflight/JSNativeActivity;)  
D AndroidRuntime: Shutting down VM  
W dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41b01700)  
E AndroidRuntime: FATAL EXCEPTION: main  
E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol   "__gnu_thumb1_case_uqi" referenced by "libPathOfLight.so"...  
E AndroidRuntime:   at java.lang.Runtime.loadLibrary(Runtime.java:361)  
E AndroidRuntime:   at java.lang.System.loadLibrary(System.java:525)  
E AndroidRuntime:   at com.js.pathoflight.JSNativeActivity.<clinit>(JSNativeActivity.java:59)  
E AndroidRuntime:   at java.lang.Class.newInstanceImpl(Native Method)    
E AndroidRuntime:   at java.lang.Class.newInstance(Class.java:1130)  
E AndroidRuntime:   at android.app.Instrumentation.newActivity(Instrumentation.java:1061)  
E AndroidRuntime:   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)  
E AndroidRuntime:   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)  
E AndroidRuntime:   at android.app.ActivityThread.access$600(ActivityThread.java:141)
E AndroidRuntime:   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
E AndroidRuntime:   at android.os.Handler.dispatchMessage(Handler.java:99)  
E AndroidRuntime:   at android.os.Looper.loop(Looper.java:137)  
E AndroidRuntime:   at android.app.ActivityThread.main(ActivityThread.java:5103)  
E AndroidRuntime:   at java.lang.reflect.Method.invokeNative(Native Method)  
E AndroidRuntime:   at java.lang.reflect.Method.invoke(Method.java:525)  
E AndroidRuntime:   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)  
E AndroidRuntime:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)  
E AndroidRuntime:   at dalvik.system.NativeStart.main(Native Method)  
W ActivityManager:   Force finishing activity com.js.pathoflight/.JSNativeActivity

I'll appreciate any suggestion.

deko
  • 2,534
  • 3
  • 34
  • 48
  • Looks like it can't find your native libraries. Have you ensured that your .so files are getting installed in your release build? – Michael Marsella Mar 18 '14 at 12:37
  • 1
    This answer http://stackoverflow.com/a/14242601/192373 was not accepted, but maybe it will help you. – Alex Cohn Mar 18 '14 at 13:03
  • @MichaelMarsella I see .so both in apk and on device – deko Mar 19 '14 at 06:34
  • @AlexCohn Thank you for suggestion. I've tried -O3, -ffreestanding and -static-libgcc but no result yet... – deko Mar 19 '14 at 06:38
  • 1
    Unfortunately, NDK does not export `__gnu_thumb1_case_uqi` in any of its libraries. Try to compile your library for ARM (use `LOCAL_ARM_MODE := arm` in **Android.mk**). – Alex Cohn Mar 19 '14 at 15:57
  • It is also possible to compile specific files to ARM (if you find which of your compiled objects looks for `__gnu_thumb1_case_uqi`): add an .arm suffix to the source file names you want to specifically compile in ARM mode. – Alex Cohn Mar 19 '14 at 15:58
  • 1
    @AlexCohn Thank you for all suggestions, I found a workaround. – deko Mar 20 '14 at 08:09

1 Answers1

2

While removing different parts of the code I found that the issue was in a 3rd party library I used.
I changed its usage from "gnustl_static" version (.a) to "gnustl_shared" (.so) one and the problem disappeared!

deko
  • 2,534
  • 3
  • 34
  • 48