在android studio 3

时间:2017-12-06 21:58:52

标签: android-studio appium

我是android studio的新手。我正在尝试使用appium的java-client-6.0.0-BETA1.jar构建Android Studio Gradle。我正在实施appium。我相信android studio是正确安装的。我已经下载了appium的推荐文件,selenium-server-standalone-3.8.1.jar,selenium-remote-driver.jar,selenium-java-3.8.1.zip以及我能看到的任何其他需要的文件。 Appium服务器已安装并正常运行。一个Android模拟器正在运行和工作。

我收到此错误:

Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Repositories\ApkProjects\EndToEndAndroidTest\app\libs\java-client-6.0.0-BETA1.jar
    at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:550)
    at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.lambda$convertToDexArchive$1(DexArchiveBuilderTransform.java:488)
    at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing io/appium/java_client/touch/TapOptions.class
The dependency contains Java 8 bytecode. Please enable desugaring by adding the following to build.gradle
android {
    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }

我尝试了推荐的修复方法 - 没有任何区别。我已经更新了guava-23.3-android也出现了类似的错误。

gradle.build文件是:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.nwri.endtoendandroidtest"
        minSdkVersion 18
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:design:26.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
//    compile 'com.google.guava:guava:23.3-android'
}

我在网上搜索过,找不到有这个问题的人。如果有帮助,这是一个屏幕截图:

Android studio

1 个答案:

答案 0 :(得分:0)

项目结构对话框中将Source CompatibilityTarget Compatibility设置为1.8帮助了我。

手动添加时

android {
    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
}

没有帮助。

enter image description here