I\'ve tried running an application using a native library on the Nexus 9.
The application exits with an error message:
java.lang.UnsatisfiedLinkError
the point is to convert the run environment to 32 bit
add the follow content in build.gradle
defaultConfig: { ... ndk { abiFilters "armeabi", "armeabi-v7a", "x86", "mips" } }
add android.useDeprecatedNdk=true
into gradle.properties
.so
file
into the new folderNop, you need to get the native library to be compatible with 64-bit for it to work.
See official documentation: JNI Tips: 64-bit Considerations
Found an explanation: 64-bit Android can use 32-bit native libraries as a fallback, only if System.loadlLibrary() can't find anything better in the default search path. You get an UnsatisfiedLinkError if you force the system to load the 32-bit library using System.load() with the full library path. So the first workaround is using System.loadLibrary() instead of System.load().
An additional thing that has to be taken into account is that libraries cannot be mixed: the fallback behaviour only applies for the first library your application loads. If the first one is 64-bit, no 32-bit libraries can be loaded by the same application, and vice versa.
For me the problem was that I enabled the advanced profiling feature under the build settings of the app
I encountered the same issue, when I did the update from Android Studio 2.1 to 2.2.3 (with ndk v.13.1), and no tips found in google really helped me (like using abiFilters, exclude 'lib/x86_64/lib….so’, LOCAL_MULTILIB := 32, or TARGET_PREFER_32_BIT := true, …).
Finally, I was able to make it worked again with the latest AS v2.2.3 (without changing anything in Android.mk or in build.gradle), just by using my previous ndk compiler, i.e. android-ndk-r10e
I built the library manually with ndk-build for "armeabi-v7a" and "x86" only, and it worked like a charm on Android with arm64.
This work for me:
ndk {
abiFilters 'armeabi-v7a', 'x86'
}