在Android Studio中安装/使用J2V8

use*_*690 3 android android-studio j2v8

我是 Android Studio 开发的新手,也是 gradle 和 j2v8 的新手。我有一个示例 Hello World 应用程序,想在其中使用 j2v8 (只是出于好奇)。我的应用程序 gradle 中有以下内容

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
    compile 'com.android.support:appcompat-v7:24.2.1'
    testCompile 'junit:junit:4.12'
    // https://mvnrepository.com/artifact/com.eclipsesource.j2v8/j2v8_android
    compile group: 'com.eclipsesource.j2v8', name: 'j2v8_android', version: '3.0.5'
}
Run Code Online (Sandbox Code Playgroud)

最后一个是我尝试添加 j2v8。接下来,我尝试了这篇文章中的示例行,因此我将以下内容添加到我的活动中:

V8 v8 = V8.createV8Runtime();
Run Code Online (Sandbox Code Playgroud)

我不明白的是我需要什么进口才能发挥作用。我肯定错过了一个或多个步骤,但很难在网上找到说明。

谢谢。

小智 5

使用编译组:'com.eclipsesource.j2v8',名称:'j2v8_android',版本:'3.0.5',添加 import com.eclipsesource.v8.V8 也不起作用。

更改为使用编译'com.eclipsesource.j2v8:j2v8_android:3.0.5@aar'工作正常。