Gradle native libraries not found on device but present in apk

My application uses Here SDK and Twilio SDK . Both use their own libraries (here SDK with local libraries locally connected to the / libs and / jniLibs folders, Twilio SDK connected to jCenter). But on Android 5.1, here the SDK throws an exception "MISSING LIBRARIES: libMAPSJNI.so", although this library is present as a result of the APK. I opened the folder where my program is installed on the device and compared the contents in two cases: with or without the Twilio SDK. The difference is that when you connect the Twilio API, folder / lib is a file, and for obvious reasons, the loader cannot see inside it, that is, you need to initialize the source libraries here SDK. If you remove the Twilio gradle dependency, the build is normal. What could be the reason and how to fix it? If necessary, I can attach a test project with these libs

+5
source share
2 answers

You need to modify your build.gradle as follows:

android { (...) splits { abi { enable true reset() include 'armeabi-v7a' universalApk false } } (...) } 

Probably because the Twilio SDK supports x86 and the HERE SDK does not currently support it.

+12
source

splits defining a splits block, you can tell Gradle to create an APK for each ABI listed :

 include "armeabi", "armeabi-v7a", "x86", "mips" 

Alternatively, you can include all the necessary ABIs in APP one by adding the following filter:

 android { (...) defaultConfig { (...) ndk { // allow only 32bit *.so libs abiFilters "armeabi", "armeabi-v7a", "x86", "mips" } } 

}

Both approaches will exclude 64-bit functionality that might run into the 32-bit HERE SDK , but the latter will support more devices with one APK.

Some libraries, such as the new Android Room Persistence library, add 32-bit flavors along with two 64-bit ABI arm64-v8a and x86_64 fragrances . Since HERE the SDK currently provides only a 32-bit library, it should be safe to exclude 64-bit lib options. On the other hand, it is expected that 64-bit devices can gracefully handle 32-bit libraries.

0
source

All Articles