I'm developing a Cordova plugin to wrap a third party SDK, which depends on several .so files. I declare the native libraries in plugin.xml like this:
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="RfidScanner">
<param name="android-package" value="org.un.eac.cordova.plugin.rfid.RfidScanner"/>
</feature>
</config-file>
<!-- armeabi .so -->
<source-file src="lib/android/armeabi/libandroid_060.so" target-dir="libs/armeabi"/>
<source-file src="lib/android/armeabi/libdevapi.so" target-dir="libs/armeabi"/>
<source-file src="lib/android/armeabi/libDeviceAPI.so" target-dir="libs/armeabi"/>
<source-file src="lib/android/armeabi/libFpCore.so" target-dir="libs/armeabi"/>
<source-file src="lib/android/armeabi/libfxjni.so" target-dir="libs/armeabi"/>
<source-file src="lib/android/armeabi/libirdaSerialPort.so" target-dir="libs/armeabi"/>
<source-file src="lib/android/armeabi/libModuleAPI_Android_Arm.so" target-dir="libs/armeabi"/>
<source-file src="lib/android/armeabi/libNETLH_E.so" target-dir="libs/armeabi"/>
<source-file src="lib/android/armeabi/libPSAM.so" target-dir="libs/armeabi"/>
<source-file src="lib/android/armeabi/libSerialPort.so" target-dir="libs/armeabi"/>
<!-- armeabi-v7a .so -->
<source-file src="lib/android/armeabi-v7a/libandroid_060.so" target-dir="libs/armeabi-v7a"/>
<source-file src="lib/android/armeabi-v7a/libdevapi.so" target-dir="libs/armeabi-v7a"/>
<source-file src="lib/android/armeabi-v7a/libDeviceAPI.so" target-dir="libs/armeabi-v7a"/>
<source-file src="lib/android/armeabi-v7a/libFpCore.so" target-dir="libs/armeabi-v7a"/>
<source-file src="lib/android/armeabi-v7a/libfxjni.so" target-dir="libs/armeabi-v7a"/>
<source-file src="lib/android/armeabi-v7a/libirdaSerialPort.so" target-dir="libs/armeabi-v7a"/>
<source-file src="lib/android/armeabi-v7a/libModuleAPI_Android_Arm.so" target-dir="libs/armeabi-v7a"/>
<source-file src="lib/android/armeabi-v7a/libNETLH_E.so" target-dir="libs/armeabi-v7a"/>
<source-file src="lib/android/armeabi-v7a/libPSAM.so" target-dir="libs/armeabi-v7a"/>
<source-file src="lib/android/armeabi-v7a/libSerialPort.so" target-dir="libs/armeabi-v7a"/>
<!-- jars -->
<source-file src="lib/android/handheldApi.jar" target-dir="libs"/>
<source-file src="lib/android/DeviceAPI.jar" target-dir="libs"/>
<source-file src="lib/android/decoderapijni.jar" target-dir="libs"/>
<source-file src="lib/android/ModuleAPI_Android_2.2.0.0.jar" target-dir="libs"/>
<source-file src="src/android/RfidScanner.java" target-dir="src/org/un/eac/cordova/plugin/rfid" />
</platform>
The generated APK contains the armeabi and armeabi-v7a in the correct location:
However I get the following error when running the app:
W/System.err(11480): java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.Handheld-2/base.apk"],nativeLibraryDirectories=[/data/app/com.example.Handheld- 2/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libdevapi.so"
I checked also Native library not loaded from cordova apk and what I found different from the original post is that the error message shows the following native library folders:
nativeLibraryDirectories=[/data/app/.../lib/arm, /vendor/lib, /system/lib]
While mine shows:
nativeLibraryDirectories=[/data/app/.../lib/arm64, /vendor/lib64, /system/lib64]
Could that difference have anything to do? Any help would be much appreciated.