错误:程序类型已存在:com.google.common.annotations.Beta

Pet*_*nes 4 dependencies android gradle

自从几天前我的android工作室更新以来,由于这个错误,我一直在努力让我的应用程序再次运行.

Program type already present: com.google.common.annotations.Beta    
Message{kind=ERROR, text=Program type already present: 
com.google.common.annotations.Beta, sources=[Unknown source file], tool name=Optional.of(D8)}
Run Code Online (Sandbox Code Playgroud)

这是我的build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.dissertation.bitcoin.bitparking"
    minSdkVersion 21
    targetSdkVersion 27
    multiDexEnabled true
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
   }
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation('com.android.support:appcompat-v7:27.1.0')
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
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 'com.google.http-client:google-http-client-android:1.23.0'
implementation 'com.google.api-client:google-api-client-android:1.23.0'
implementation 'com.google.code.findbugs:jsr305:2.0.1'
implementation 'com.google.api-client:google-api-client-gson:1.23.0'
implementation 'com.googlecode.json-simple:json-simple:1.1'
implementation files('libs/java-json.jar')
implementation 'com.android.support:support-compat:27.1.0'
implementation 'com.github.bumptech.glide:glide:4.3.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google:bitcoinj:0.11.3'
implementation 'de.schildbach.wallet:integration-android:2.0'
}
Run Code Online (Sandbox Code Playgroud)

这个代码上周对我很好.然而,由于我对Android开发相当新,我可能忽略了一些东西.任何帮助将不胜感激,谢谢.

小智 13

只需尝试添加exclude module: 'guava-jdk5'到谷歌apis导入,如下所示:

implementation('com.google.api-client:google-api-client-android:1.20.0') {
    exclude module: 'guava-jdk5'
}
Run Code Online (Sandbox Code Playgroud)

  • 你是如何弄清楚google-api库和Guava库有链接的? (6认同)