How to include shared library files (.SO) in android APK using cordova plugin?
Application Type
Mobile
Service Studio Version
11.11.12 (Build 47321)
Platform Version
11.12.1 (Build 30548)

Hi there,

I'm working on cordova plugin which will use 3rd party sdk on Android device.
For that sdk I have a demo app (native APK) which is fully functioning on device.

When I added SDK JAR files to my cordova plugin then I noticed that SDK is working except the methods which require *.SO files supplied with SDK.
Now I'm trying to add then in PLUGIN.XML in different ways like:
<lib-file src="sdk/armeabi/libDeviceConfig.so" />

<resource-file src="sdk/armeabi/libDeviceConfig.so" target="jniLibs/arm/libDeviceConfig.so"/>
<resource-file src="sdk/armeabi/libDeviceConfig.so" target="lib/arm/libDeviceConfig.so"/>

<source-file src="sdk/armeabi/libDeviceConfig.so" target-dir="/data/resource/lib"/>
<source-file src="sdk/armeabi/libDeviceConfig.so" target-dir="/vendor/lib"/>
<resource-file src="sdk/armeabi/libDeviceConfig.so" target="jniLibs/arm/libDeviceConfig.so"/>
<resource-file src="sdk/armeabi/libDeviceConfig.so" target="lib/arm/libDeviceConfig.so"/>

etc.

So finally they appear in APK:

 

But at runtime i'm getting error:
08-14 13:43:02.966 6783 6783 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dalvik.system.DexClassLoader[DexPathList[[dex file "/data/user/0/com.planetpayment.globaldevtaxfree.PaxPlugin2/files/nepcore.dex"],nativeLibraryDirectories=[/data/app/com.planetpayment.globaldevtaxfree.PaxPlugin2-2/lib/arm, /data/resource/lib, /vendor/lib, /system/lib]]] couldn't find "libDeviceConfig.so"

Also I added build.gradle having:

dependencies {
    implementation fileTree(include: ['*.jar','*.so'], dir: 'sdk') // .SO files located in sdk/armeabi

But nothing changed yet.

I'll appreciate a lot if someone may help me how to solve this problem: finally I should have .SO files in directory included into "nativeLibraryDirectories".

I have feeling this can be solved via gradle file but can't make this working still.
Any help appreciated a lot!!!!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.