我有一个使用j2v8_android 2.2.1
库的 gradle 项目(它为 V8 JS 引擎提供 Java 绑定 - android 端口)。j2v8_android_x86
不幸的是,在执行项目后(构建成功没有问题),我得到一个与缺少库文件相关的异常。V8
尝试创建运行时时会出现问题:
V8 runtime = V8.createV8Runtime();
例外本身是:
Caused by: java.lang.IllegalStateException: J2V8 native library not loaded.
at com.eclipsesource.v8.V8.checkNativeLibraryLoaded(V8.java:86)
at com.eclipsesource.v8.V8.createV8Runtime(V8.java:74)
at com.eclipsesource.v8.V8.createV8Runtime(V8.java:63)
(...)
Caused by: java.lang.UnsatisfiedLinkError: Could not load J2V8 library. Reasons:
Couldn't load j2v8_android_x86 from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.androidscripting.app-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.androidscripting.app-1, /vendor/lib, /system/lib, /system/lib/arm]]]: findLibrary returned null
at com.eclipsesource.v8.LibraryLoader.loadLibrary(LibraryLoader.java:71)
at com.eclipsesource.v8.V8.load(V8.java:49)
at com.eclipsesource.v8.V8.createV8Runtime(V8.java:72)
... 17 more
当我调查时,我在(和)apk
的根目录中看到两个库文件。如果我理解正确,这些文件的名称和位置是正确的,应该解决它们。apk
libj2v8_android_armv7l.so
libj2v8_android_x86.so
该应用程序由Gradle 2.2.1
(on Oracle JVM 1.8.0_45
) 编译和打包,具有Android SDK 19
兼容性(具有语言级别支持1.7
)并在Hudl2
运行时执行Android 4.4.2
。