I've a native android app (NativeActivity
, no java code but only libMyApp.so
native library)
The app runs perfectly on Android 5.0.1 and 5.1.1 but crashes on android 4.3 and 4.2.2
For 5.0.1 and 5.1.1 versions load the .so
lib successfully from
/data/data/com.example.myapp/lib/libMyApp.so
4.3 and 4.2.2 versions try to load from one of following locations
/data/app-lib/com.example.myapp-1/libMyApp.so
/data/app-lib/com.example.myapp-2/libMyApp.so
The error message is
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapp/android.app.NativeActivity}: java.lang.IllegalArgumentException: Unable to load native library: /data/app-lib/com.example.myapp-2/libMyApp.so
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2295)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
at android.app.ActivityThread.access$700(ActivityThread.java:159)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method
My app has a single shared library i.e. doesn't depend on third party libs.
And the module name is specified in manifest file like this
<meta-data android:name="android.app.lib_name"
android:value="MyApp" />
The libMyApp.so
is linked with -llog -lGLESv3 -lGLESv2 -lGLESv1_CM -lEGL -landroid -lz
libs.
Why the lib cannot be loaded, what I'm missing ?
Why old android versions do not load from /data/data/com.example.myapp/lib/
?!
Does the older android versions have another module naming convention ?