Unable to find ARM64 NDK built-in library using Android Studio (1.3 RC)

Fatal exception: java.lang.UnsatisfiedLinkError dalvik.system.PathClassLoader [DexPathList [[zip file] "/data/app/com.myapp-1/base.apk"], nativeLibraryDirectories = [/ data / app / com.myapp- 1 / lib / arm64, / vendor / lib 64, / system / lib64]]] could not find "libnative.so"

This only happens on ARM64 devices. I do not configure any custom NDK assembly in gradle settings.

It looks like Android Studio somehow messed up the correct folder to copy the .so file.

How is it and how to fix it?

+2
android android-studio android-ndk
source share
2 answers

Basically what we need to do is put your .so files inside a folder called lib (Note: these are not libs, and this is not an error). It must be in the same structure, it must be in the APK file.

Project:

| --lib:

| - | --armeabi:

| - | - | -. therefore files.

1) So, I created the lib folder and inside it the armeabi folder, where I inserted all the necessary .so files.

2) Then I pinned the folder to .zip (the structure inside the zip file is now lib / armeabi / *. So).

3) Then I renamed the .zip file to armeabi.jar.

4) And added the compilation line fileTree (dir: 'libs', include: '* .jar') depending on {} in the gradle assembly file.

0
source share

Maybe you are using another library that inserts .so files for arm64-v8a? Open the APK as a zip file and look in the lib folder to see if it works.

Then, to fix your problem, you can use abiFilters to include only .so files for architectures that you fully support:

 android { .... defaultConfig { .... ndk { abiFilters "armeabi-v7a", "x86" } } } 
0
source share

All Articles