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

标签 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
 }

任何帮助,将不胜感激

最佳答案

有了这个 :
./gradlew应用程序:依赖项
我获得了依赖项的详细信息,因此我检测到问题来自androidannotations

所以代替:

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

我不得不说:

注解处理器(“org.androidannotations:androidannotations:$ AAVersion”)
实现(“org.androidannotations:androidannotations-api:$ AAVersion”)

并添加:

multiDexEnabled是

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

关于android - 升级gradle之后:程​​序类型已经存在:net.jcip.annotations.GuardedBy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55358360/

相关文章:

android - 将 xml 转换为 json android

java - build.gradle 从另一个类访问公共(public)变量—— list 占位符

gradle - 从 Ant 迁移到Gradle

chalice 未能建立 war

android - 如何让我的 Android 应用出现在用于分享内容的应用列表中?

android - 水平线性布局中两个 TextView 的不同重力

css - 有没有更好的方法来包含 npm 安装的 CSS 文件?

dependencies - Gradle:如何显示出现依赖冲突的位置

android - 将文本数组设置为 TextView 数组

Gradle:如何在控制台上打印依赖项工件 url