我正在开发一个Cordova插件来包装第三方SDK,这取决于几个 .so 文件。我在plugin.xml中声明了这样的本地库:
<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>
生成的APK在正确的位置包含armeabi和armeabi-v7a:
但运行应用程序时出现以下错误:
W / System.err(11480):java.lang.UnsatisfiedLinkError:dalvik.system.PathClassLoader [DexPathList [[zip file&#34; /data/app/com.example.Handheld-2/base.apk 34],nativeLibraryDirectories = [/数据/应用程序/ com.example.Handheld- 2 / lib / arm64,/ vendor / lib64,/ system / lib64]]]无法找到&#34; libdevapi.so&#34;
我还检查了Native library not loaded from cordova apk,我发现与原帖不同的是错误消息显示以下本机库文件夹:
nativeLibraryDirectories = [/ data / app /.../ lib / arm,/ vendor / lib,/ system / lib]
我的节目显示:
nativeLibraryDirectories = [/ data / app /.../ lib / arm64,/ vendor / lib64,/ system / lib64]
这种差异有什么关系吗?任何帮助将不胜感激。