6

My application uses Here SDK and Twilio SDK. Both uses native libraries (Here SDK with native libraries locally plugged in from /libs and /jniLibs folders, Twilio SDK plugged in from jCenter). But on Android 5.1 Here SDK throws exception "MISSING LIBRARIES: libMAPSJNI.so" although this library present in result APK. I opened folder where my program is installed on device and compared content in two cases: with or without Twilio SDK. The difference is that when connected Twilio API folder /lib is a file, and for obvious reasons, the loader can not see inside it native libraries needed initialize Here SDK. If remove the Twilio gradle dependency the assembly occurs normally. What could be a reason and how to fix it? If needed I can attach test project with these libs

Megan Speir
  • 3,745
  • 1
  • 15
  • 25
ibogolyubskiy
  • 2,271
  • 3
  • 26
  • 52

2 Answers2

12

You need to modify your build.gradle like this:

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

It's probably because Twilio SDK supports x86 and HERE SDK currently doesn't support it.

Artem Nikitin
  • 835
  • 1
  • 8
  • 10
  • 1
    Hey Artem, Thanks for jumping in for the Twilio community here. Can we send you a shirt to share our appreciation? Send an email to mspeir@twilio.com for details. – Megan Speir Aug 24 '16 at 23:08
  • This applies for other architectures there HERE SDK does not support as well (such as arm64-v8a) – AndrewJC Aug 09 '17 at 01:17
1

By defining a splits block you can tell Gradle to create APKs for each listed ABI:

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

Alternatively you can include all desired ABIs into one APK by adding the following filter:

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

}

Both approaches will exclude 64bit functionality that might clash with the 32bit HERE SDK, but the latter will support more devices with a single APK.

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

Nusatad
  • 3,231
  • 3
  • 11
  • 17