Native application crashes on Android L
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.
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)
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
Listview does not populate songs from sd card in fragments
Request permission dialog box is not popping up in Android Marshmallow
Double header bar on Android DatePicker when fragments are reopened
Andriod OpenGLSE3.0 Volume Rendering
Notification onClick Intent sends wrong data to Activity
error duplicate entry: com/google/android/gms/common/api/zze.class
Make Map Fragment Clickable When DrawerLayout (NavigationDrawer) Is Opened
Share video 'with caption' on whatsapp on Android
Unable to register Android App with Google Firebase Messaging service: “Not allowed to start service Intent”
How can I turn Ambient Display on/off programmatically?
Base Activity doesnt get API response in onTaskComplete
How to chage the color of actionbar in android [duplicate]
Can i put a logic in different file to process a fragment file? Android Studio
Alert Dialog: play mp3 till it's displayed
Data not listed as dropdown in spinner android?