小编Esh*_* NE的帖子

如何解决gradle构建中的重复类错误?

我曾尝试将 ibm 音调分析器 api 用于我的项目,但如果我包含依赖项,则会出现此错误:

在模块 annotations-3.0.1.jar (com.google.code.findbugs:annotations:3.0.1) 和 jsr305-3.0.2.jar (com.google.code.findbugs:jsr305) 中发现重复类 javax.annotation.CheckForNull :3.0.2) 在模块 annotations-3.0.1.jar (com.google.code.findbugs:annotations:3.0.1) 和 jsr305-3.0.2.jar (com.google.代码.findbugs:jsr305:3.0.2)

我已经尝试删除测试依赖项,但仍然无效,请帮忙

应用程序文件:

apply plugin: 'com.android.application'

android {
    configurations.all{

            resolutionStrategy.cacheChangingModulesFor 0, 'seconds'

    }
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.loginapp"
        minSdkVersion 22
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"

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

dependencies {

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

    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    compile 'com.ibm.watson:tone-analyzer:7.0.0'
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: …
Run Code Online (Sandbox Code Playgroud)

java android gradle android-gradle-plugin

6
推荐指数
1
解决办法
8441
查看次数

标签 统计

android ×1

android-gradle-plugin ×1

gradle ×1

java ×1