7

I have a native application that always worked on Android KitKat with both Dalivik and ART runtimes, but it now crashes on Android L with the following trace:

E/art(12810): dlopen("/data/app-lib/com.mylib.example", RTLD_LAZY) failed: dlopen failed: cannot locate symbol "issetugid" referenced by "mylib.so"...
D/AndroidRuntime(12810): Shutting down VM
E/AndroidRuntime(12810): FATAL EXCEPTION: main
E/AndroidRuntime(12810): Process: com.mylib.example, PID: 12810
E/AndroidRuntime(12810): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "issetugid" referenced by "mylib.so"...
E/AndroidRuntime(12810):    at java.lang.Runtime.loadLibrary(Runtime.java:364)
E/AndroidRuntime(12810):    at java.lang.System.loadLibrary(System.java:610)

Is ART runtime in Android L different from KitKat? There is no new NDK available yet, therefore, how to avoid this crash, because it seems that the function issetugid is no longer supported.

10
  • 1
    It is possible that seeing the relevant code might help here? Commented Jun 27, 2014 at 12:52
  • It simply fails to load the native lib. Commented Jun 27, 2014 at 13:12
  • Ahh, OK. I'm an idiot. I didn't see the error.. which is plain as day in your brief trace... Ignore me! Commented Jun 27, 2014 at 13:20
  • 2
    Also there is a bug now code.google.com/p/android-developer-preview/issues/… Commented Jun 27, 2014 at 21:18
  • Is there going to be a fix soon or should we flash back to 4.4.4? Commented Jun 27, 2014 at 21:22

2 Answers 2

1

The issue has been fixed in the final Android 5.0 release. There is no need to re-compile existing binaries.

However, if the native lib is compiled with target android-21, it fails on previous Android versions (< 5.0)

Sign up to request clarification or add additional context in comments.

6 Comments

arsalank2, so you just kept your target the same?
Yes, I used android-19 to support previous versions.
So you compiled it twice? or are you saying you targeted android-19 to support all devices including Android 5.0? How did you target all devices?
No, I compiled it once with target android-19 to support all the devices.
So compiling with a target of android-19 works on all API levels such as API 9+?
|
0

I think i may have the answer, please correct me if iam wrong.I had faced similar issue and now its fixed (or i have found a workaround rather)

while registering native method to JNI, there are two ways of doing it.

1) Implement JNI_OnLoad() method in your .cpp file and register your native methods with the appropriate classes. Check- http://developer.android.com/training/articles/perf-jni.html#native_libraries example - https://android.googlesource.com/platform/development/+/master/samples/SimpleJNI/jni/native.cpp

2) there is a particular naming convention to follow for the native methods, where the class path (including package) have to be added. Check - http://docs.oracle.com/javase/6/docs/technotes/guides/jni/spec/design.html#wp615 Here we need not implement any method. The JVM discovers the native method from the symbol names it self from the binary.

The first method doesn't seem to work in Android ART runtime (ART is Optional in kitkat and it will be the only runtime in Lolipop).I am not not sure why it doesnt work. but i think the reason is because the way ART performs.(The bytecodes are converted and cached during install time itself instead of runtime, so that app runs faster). So since the native libs are not loaded (on_load is not called) the conversion to machine code fails at some point

Use the second method to register natives. it should work. Only disadvantage is now your function names will be and long and will look horrible (i bet none of the function will fit in 100char limit).bye bye function name readability.

Hope this helps

Cheers, Shrish

2 Comments

What you are calling "the second method" is the way JNI on Android was originally done; if you are really running into a 100-character limit you might want to rethink your namespace for readability. More importantly, it seems unlikely that these comments have much of anything to do with the rather specific error in the question.
More specifically, the problem at the core of this question is one which occurs when a function changes from being dynamically linked to being declared either inline or as a macro, such that its implementation should be automatically included in the build of the client program and not provided by the dynamic library. The poster's existing build assumes it will be provided by the dynamic library at runtime. But their new device assumes it should be included in the client program (and does not provide it in the library), thus incompatibility results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.