How to use 32-bit native libaries on 64-bit Android device

7,268 views
Skip to first unread message

fabian Hoyos

unread,
Oct 2, 2015, 4:44:02 PM10/2/15
to android-ndk
Hi, guys, I have a problem to run a application with native libraries {armabi, armabi-v7a, x86, mips} in Android device 64 bits architecture, when I try install the application launch the next error:

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.myapp-2/base.apk"],nativeLibraryDirectories=[/data/app/com.myapp-2/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "lib.so"
How can I configure to install 32 bit native library in n Android device 64 bits architecture, I am using Android Studio 1.4 and use with flag usedkDeprecated=true
thanks for the help?

Xavier Hallade

unread,
Oct 3, 2015, 4:41:01 AM10/3/15
to android-ndk
Hi,

Your 32 bit libraries should get installed automatically. Are you sure you don't have additional 64bit libraries inside your APK?

When you install an APK, the system will look for native libraries directories (armeabi, armeabi-v7a, arm64-v8a, x86, x86_64, mips64, mips) inside the lib folder of the APK, in the order determined by Build.SUPPORTED_ABIS.

If your app happen to have a compatible 64bit directory with missing libs, the missing libs will not be installed from another directory, the libs aren't mixed. That means you have to provide the full set of your libraries for each architecture.

So, to solve your issue, you can remove your 64-bit libs from your build, or set abiFilters to package only 32-bit architectures:

android {
....
defaultConfig {
....
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
}
}
}

fabian Hoyos

unread,
Oct 5, 2015, 9:54:08 AM10/5/15
to android-ndk


HI, Xavier, thanks for your help, I am setting in the project gradle this:

ndk {

abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
}

 I am testing in the Android device, but it doesn't work, launch the same error, I am testing in the DragonBoard 410c.

Xavier Hallade

unread,
Oct 5, 2015, 10:08:14 AM10/5/15
to android-ndk
Ok, that means your problem is somewhere else.

Is your app able to run on a 32-bit device?
can you give more information on your app architecture ? 
What lib do you have, where are they in your app project, what's your build.gradle configuration, and the list of files under "lib/" insde your APK (open it as a zip file)?

Regards,
Xavier Hallade.

fabian Hoyos

unread,
Oct 5, 2015, 1:13:12 PM10/5/15
to android-ndk

OK, the answers:

Is your app able to run on a 32-bit device?

This app runs on severals 32-bit  Android devices like  smartphone galaxy S4, motorola, LG

can you give more information on your app architecture ? 

the architecture of the project, use a android library that implements the android native libraries and use native libraries of the opencv 2.4.11 only support (armabi, armabi-v7a, x86,mips),  and use other native library have (armabi, armabi-v7a, x86,mips), when I try to run the app in this device https://developer.qualcomm.com/hardware/dragonboard-410c, the app launch the same error, but I compile a native library in arm64-v8a and thsi library if it was load on device.

But the other library that depend of the opencv 2.4.11 I doesn't compile in arm64-v8a because this opencv version 2.4.11 does n't have support to arm64-v8a.


What lib do you have, where are they in your app project, what's your build.gradle configuration, and the list of files under "lib/" insde your APK (open it as a zip file)?
 when I open the apk like a .zip, in the lib folder there are:

lib/
  -arm64-v8a
  -armabi
  -armabi-v7a
  -x86
 -mips

Xavier Hallade

unread,
Oct 6, 2015, 4:29:35 AM10/6/15
to android-ndk
If you can't get all your libraries to compile for arm64-v8a (because of the version of OpenCV you're using), you have to compile none of them for arm64-v8a and remove the arm64-v8a folder from your app.

--
You received this message because you are subscribed to a topic in the Google Groups "android-ndk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-ndk/WqXoeSeBvTI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-ndk.
For more options, visit https://groups.google.com/d/optout.

fabian Hoyos

unread,
Oct 9, 2015, 1:12:25 PM10/9/15
to android-ndk
Hi, Thanks for help, I look in the apk, there is arm64 folder, this was the possible error because there weren't all libs to this architecture, I look the way a new version opencv (3.0) with support to arm64.
Reply all
Reply to author
Forward
0 new messages