Unable to run Android app after updating to cordov

2019-08-01 17:41发布

问题:

I have created an Cordova Android 7 app while running app I get an error at

system.load("xxxx")

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader ......:couldn't find "xxxx.so"

in plugin.xml file I have defined jar and .so file like below :

<lib-file src="src/android/libs/xxxxx.jar"/>

<resource-file src="src/android/libs/armeabi/xxxx.so" target="libs/armeabi/xxxx.so" />

I hav tried all the possible ways by changing paths but no luck.What should be done to load library correctly ?

PS:The app works fine with cordova android version <7.

There is similar SO thread Add .so files to Cordova Plugin

回答1:

I am able to resolve this issue by renaming libs to jniLibs.

Change

<resource-file src="src/android/libs/armeabi/xxxx.so" target="libs/armeabi/xxxx.so"/>

to

<resource-file src="src/android/libs/armeabi/xxxx.so" target="jniLibs/armeabi/xxxx.so"/>