向Gradle Android Studio 3.0.1添加依赖项后出错

时间:2018-02-27 16:01:56

标签: java android

我创建了一个新项目。他编译了apk,没关系。然后我在Gradle for Selenium中添加依赖项(最后2个)。 Gradle正常同步,但在尝试编译apk后我得到错误:

Error:com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\MAX\.gradle\caches\modules-2\files-2.1\xerces\xercesImpl\2.11.0\9bb329db1cfc4e22462c9d6b43a8432f5850e92c\xercesImpl-2.11.0.jar
Error:com.android.builder.dexing.DexArchiveBuilderException: Error while dexing org/apache/xerces/impl/xpath/regex/Token.class
Error:com.android.dx.cf.iface.ParseException: bad utf-8 byte 80 at offset 00000021
Error:java.lang.IllegalArgumentException: bad utf-8 byte 80 at offset 00000021
Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\MAX\.gradle\caches\modules-2\files-2.1\xerces\xercesImpl\2.11.0\9bb329db1cfc4e22462c9d6b43a8432f5850e92c\xercesImpl-2.11.0.jar 

我的傻瓜:

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 26
        defaultConfig {
            applicationId "com.test.myapp"
            minSdkVersion 15
            targetSdkVersion 26
            versionCode 1
            multiDexEnabled true
            versionName "1.0.4"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        implementation 'com.android.support:appcompat-v7:26.1.0'
        implementation 'com.android.support:design:26.1.0'
        implementation 'com.android.support.constraint:constraint-layout:1.0.2'
        implementation 'com.android.support:support-v4: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'

        implementation files('libs/activation.jar')
        implementation files('libs/additionnal.jar')
        implementation files('libs/mail.jar')

        compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '2.53.1'
        compile group: 'org.seleniumhq.selenium', name: 'selenium-htmlunit-driver', version: '2.52.0'

    }

1 个答案:

答案 0 :(得分:0)

看起来糟糕的下载。

尝试删除您的gradle缓存,更改存储库以及重建jar。