ABI set not compatible
If you see the following error when initializing Nutrient, there may be multiple reasons. We’ll cover the two most frequent ones below:
05-17 15:07:32.827 E/PSPDFKit: The device's ABI set is not compatible with PSPDFKit: [some ABIs] 05-17 15:07:32.827 W/System.err: com.pspdfkit.exceptions.PSPDFInitializationFailedException: Failed to initialize PSPDFKit. 05-17 15:07:32.827 W/System.err: at com.pspdfkit.PSPDFKit.initialize(SourceFile:109) ... 05-17 15:07:32.837 W/System.err: at java.lang.reflect.Method.invoke(Method.java:525) 05-17 15:07:32.837 W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:744) 05-17 15:07:32.837 W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 05-17 15:07:32.837 W/System.err: at dalvik.system.NativeStart.main(Native Method)
Device may be incompatible
This error means that the device you’re running Nutrient on is binary incompatible, and you should consult the list of CPU architectures supported by Nutrient.
ABI conflict with another native library
This error can appear if your app contains another library with native binaries that conflict with Nutrient. This can happen when using Nutrient with another library that either contains armeabi
or mips
binaries.
Here’s why this conflict happens: When installing an APK file that contains native libraries for multiple CPU architectures onto a device, the Android OS will select the correct libraries at install time. If you bundle native libraries for various ABIs, the OS will only select the single device ABI and copy it to the <myapp>/libs/
directory on the user’s device. If one device is missing binaries for the selected ABI, your app will likely generate an error (like the one above).
To fix the issue, you can enable ABI filtering in your build.gradle
to remove all non-supported ABI sets. Just explicitly define the set of ABIs you would like to include in your final APK.
The following snippet will keep all binaries supported by Nutrient:
android { defaultConfig { ndk { // This will strip all non-supported ABI sets from the final APK file. abiFilters 'x86', 'x86_64', 'arm64-v8a', 'armeabi-v7a' } } }