Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用Appium库在android studio中生成gradle文件时出错_Java_Android_Appium - Fatal编程技术网

Java 使用Appium库在android studio中生成gradle文件时出错

Java 使用Appium库在android studio中生成gradle文件时出错,java,android,appium,Java,Android,Appium,这是我的Build.gradle文件: apply plugin: 'com.android.application' android { compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } compileSdkVersion 26 defaultConfig {

这是我的Build.gradle文件:

apply plugin: 'com.android.application'

android {

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.mynewapp"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'

        exclude 'org/openqa/selenium/remote/isDisplayed.js'
        exclude 'org/openqa/selenium/firefox/webdriver_prefs.json'
        exclude 'org/openqa/selenium/remote/getAttribute.js'
        exclude 'org/openqa/selenium/firefox/webdriver.xpi'
        exclude 'okhttp3/internal/publicsuffix/publicsuffixes.gz'
        exclude 'org.openqa.selenium.Architecture$1'

    }
}

    dependencies {
    //    implementation fileTree(include: ['*.jar'], dir: 'libs')

        //noinspection GradleCompatible
        implementation 'com.android.support:appcompat-v7:26.1.0'
        /*implementation 'io.particle:devicesetup:0.4.9'*/

        implementation 'com.android.support.constraint:constraint-layout:1.1.3'
        //testImplementation 'junit:junit:4.12'
        implementation 'com.google.android.gms:play-services-auth:16.0.1'
        implementation('org.seleniumhq.selenium:selenium-java:2.41.0')
        testImplementation 'org.assertj:assertj-core:2.0.0'
        testImplementation 'org.testng:testng:6.9.10'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
        implementation files('libs/apache-mime4j-0.6.jar')
        implementation files('libs/byte-buddy-1.8.15.jar')
        implementation files('libs/client-combined-3.141.59.jar')
        implementation files('libs/commons-codec-1.10.jar')
        implementation files('libs/commons-collections-3.2.1.jar')
        implementation files('libs/commons-exec-1.3.jar')
        implementation files('libs/commons-io-2.4.jar')
        implementation files('libs/commons-lang3-3.7.jar')
        implementation files('libs/commons-logging-1.1.3.jar')
        implementation files('libs/commons-validator-1.4.1.jar')
        implementation files('libs/gson-2.3.1.jar')
        implementation files('libs/guava-21.0.jar')
        implementation files('libs/hamcrest-core-1.3.jar')
        implementation files('libs/httpclient-4.4.1.jar')
        implementation files('libs/httpcore-4.4.1.jar')
        implementation files('libs/httpmime-4.4.1.jar')
        implementation files('libs/java-client-3.2.0.jar')
        implementation files('libs/junit-4.12.jar')
        implementation files('libs/okhttp-3.11.0.jar')
        implementation files('libs/okio-1.14.0.jar')
        implementation files('libs/selenium-java-2.47.1.jar')
        implementation files('libs/selenium-server-standalone-3.141.59.jar')

    }
然后,当我运行该文件时,我得到的错误是

错误:程序类型已存在:org.openqa.selenium.Architecture$1

我经常犯这个错误 因此,我无法运行我的文件


这个错误是在我添加java客户端库和所有其他库之后出现的,我不能特别说是哪个库,但我认为这是由于库的原因。有人能给我建议解决这个问题的方法吗。因此,它导致了错误。您已包含此依赖项

    implementation('org.seleniumhq.selenium:selenium-java:2.41.0')
还有这个

  implementation files('libs/selenium-java-2.47.1.jar')

所以,明智地选择,如果您有两个具有类似组件的库,您需要哪一个。因此,它导致了错误。您已包含此依赖项

    implementation('org.seleniumhq.selenium:selenium-java:2.41.0')
还有这个

  implementation files('libs/selenium-java-2.47.1.jar')

因此,请明智地选择,您需要哪一个

这可能会帮助您@Ashvinsolanki,我在执行以下命令后出现此错误**错误:程序类型已存在:com.google.common.annotations.GwtCompatible**尝试对
实现文件('libs/guava-21.0.jar')使用排除选项{排除组:'com.google.common.annotations.GwtCompatible'}
此错误后,我收到此错误:程序类型已存在:com.google.common.annotations.BetaThanks it helpedthis may help you@Ashvinsolanki,我收到以下命令后收到此错误**错误:程序类型已存在:com.google.common.annotations.GwtCompatible**尝试将排除选项与
impleme一起使用声明文件('libs/guava-21.0.jar'){排除组:'com.google.common.annotations.GwtCompatible'}
此错误后我收到此错误:程序类型已存在:com.google.common.annotations.BetaThanks it Helped删除其中一个依赖项后,我收到此错误:程序类型已存在:com.google.common.annotations.gwtcompatibleeter删除其中一个de我得到的悬而未决信息,错误:程序类型已存在:com.google.common.annotations.GwtCompatible