I have an app with 2 native libraries. 1st works much faster on ARMv7 so I have version both for ARMv7 and ARMv5. 2nd works the same on both platforms so only ARMv5 library is provided.
My native library folder looks like this:
/jniLibs/
|
+---armeabi/
| |
| +---libFirstLibrary.so
| +---libSecondLibrary.so
|
+---armeabi-v7a/
|
+---libFirstLibrary.so
The app works well on all devices and Android versions in production.
When I tested it on my Nexus 5 with L-Preview (hammerhead-lpv79-preview-ac1d8a8e.tgz), I get this error:
java.lang.UnsatisfiedLinkError: Couldn't load SecondLibrary from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.package-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.package-1, /vendor/lib, /system/lib]]]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:358)
at java.lang.System.loadLibrary(System.java:610)
The problem is that despite the fact Nexus 5 has CPU_ABI
set to armeabi-v7a
and CPU_ABI2
set to armeabi
, L-Preview uses just CPU_ABI
value and looks for "SecondLibrary" only in "armeabi-v7a" folder and crashes as it is not there.
When I copy the .so file also to "armeabi-v7a" folder, everything is fine but the APK is 3.5 MB bigger which I don't really like.
Is it just a bug of Android L-Preview or some "new feature"?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…