升级gradle之后:程​​序类型已经存在:net.jcip.annotations.GuardedBy

时间:2019-03-26 13:27:22

标签: android gradle dependencies

在升级gradle(也是gms)之后,我出现了错误

程序类型已存在:net.jcip.annotations.GuardedBy 消息{种类=错误,文本=程序类型已存在:net.jcip.annotations.GuardedBy,来源= [未知源文件],工具名称= Optional.of(D8)}

  apply plugin: 'com.android.application'
 configurations {
  all*.exclude group: 'com.android.support', module: 'support-v4'
  }
  buildscript {
  repositories {
     jcenter()
    mavenCentral()
 }

 }
   def AAVersion = '4.6.0' // change this to your desired version, for 
  example the latest stable: 4.1.0


 android {
 signingConfigs {
    config {
        keyAlias 'toefl2017'
        keyPassword 'sangohan1987'

        storePassword 'sangohan1987'
    }
}
compileSdkVersion 28
buildToolsVersion "28.0.0"
defaultConfig {
    applicationId "com.ouamassi.widaf"
    minSdkVersion 14
    targetSdkVersion 28
    versionCode 5
    versionName "1.03"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
    javaCompileOptions{
        annotationProcessorOptions{
            includeCompileClasspath = true
        }

    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}


buildTypes {
    release {
        minifyEnabled false
        debuggable false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.config
    }
    debug {
    }
}
packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/LGPL2.1'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/ASL2.0'
}
}

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

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation ('com.android.billingclient:billing:1.2.2')
implementation ("org.androidannotations:androidannotations:$AAVersion")
implementation ("org.androidannotations:androidannotations-api:$AAVersion")
implementation ('com.google.android.gms:play-services:12.0.0')
implementation project(path: ':fivestarslibrary', configuration: 'default')

}

这个GuardedBy东西在哪里?我搜索它,但没有找到任何内容

通用gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

 buildscript {
  repositories {
    jcenter()
    google()
}
dependencies {

    classpath 'com.android.tools.build:gradle:3.1.1'
    classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
    classpath 'com.google.gms:google-services:3.1.0'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
  repositories {
    google()
    jcenter()
}
}

task clean(type: Delete) {
   delete rootProject.buildDir
 }

任何帮助将不胜感激

1 个答案:

答案 0 :(得分:0)

与此: ./gradlew应用程序:依赖项 我了解了依赖项的详细信息,因此我发现问题来自androidannotations

所以不是:

实现(“ org.androidannotations:androidannotations:$ AAVersion”) 实现(“ org.androidannotations:androidannotations-api:$ AAVersion”)

我不得不放:

annotationProcessor(“ org.androidannotations:androidannotations:$ AAVersion”)     实现(“ org.androidannotations:androidannotations-api:$ AAVersion”)

并添加:

multiDexEnabled是

实现'com.android.support:multidex:1.0.3'