user2680690
user2680690

Reputation: 31

Installing/Using J2V8 in Android Studio

I am new to Android Studio development, as well as gradle and j2v8. I have a sample Hello World app and want to use j2v8 in it (just for curiosity). I have the following in my application 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'
}

The last one in there is my attempt at adding j2v8. Next I tried a sample line from this post, so I added the following to my Activity:

V8 v8 = V8.createV8Runtime();

What I don't understand is what imports I need for that to work. I must be missing one or more steps but had a hard time finding instructions online.

Thanks.

Upvotes: 3

Views: 3014

Answers (2)

alex
alex

Reputation: 51

using compile group: 'com.eclipsesource.j2v8', name: 'j2v8_android', version: '3.0.5' , add import com.eclipsesource.v8.V8 also not work.

change to using compile 'com.eclipsesource.j2v8:j2v8_android:3.0.5@aar' works fine.

Upvotes: 5

user2680690
user2680690

Reputation: 31

My own solution:

  1. download 3.0.5 aar file from here

  2. Add as a module via Android studio following these directions

Upvotes: 0

Related Questions