java-更新Gradle依赖项后生成错误.嫌疑犯#1是火力发源地

java-更新Gradle依赖项后生成错误.嫌疑犯#1是火力发源地,第1张

概述我有一个构建良好的应用程序,但是当我尝试更新某些Gradle依赖项时就开始失败,而主要的怀疑对象是firebase.这是我得到的错误:Causedby:com.android.builder.multidex.D8MainDexList$MainDexListException:com.android.tools.r8.errors.CompilationError:Programtypea

我有一个构建良好的应用程序,但是当我尝试更新某些Gradle依赖项时就开始失败,而主要的怀疑对象是firebase.

这是我得到的错误:

Caused by:
com.android.builder.multIDex.D8MainDexList$MainDexListException:
com.androID.tools.r8.errors.CompilationError: Program type already
present: com.Google.androID.gms.internal.measurement.zzdz

这是我的项目的git diff,显示了Gradle文件中的差异:

diff --git a/androID/build.gradle b/androID/build.gradleindex 9f63f745..08fda2eb 100644--- a/androID/build.gradle+++ b/androID/build.gradle@@ -81,8 +81,8 @@ dependencIEs {     implementation "com.badlogicgames.gdx:gdx-backend-androID:$gdxVersion"     implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"     implementation "com.androID.billingclIEnt:billing:$playBillinglibVersion"-    implementation "com.Google.firebase:firebase-core:16.0.3"-    implementation "com.Google.firebase:firebase-ads:15.0.1"+    implementation "com.Google.firebase:firebase-core:16.0.5"+    implementation "com.Google.firebase:firebase-ads:17.0.0"     implementation 'com.crashlytics.sdk.androID:crashlytics:2.9.5'     implementation filetree(include: ['*.jar'], dir: 'libs')diff --git a/androID_common/build.gradle b/androID_common/build.gradleindex f8224509..3a5d45e1 100644--- a/androID_common/build.gradle+++ b/androID_common/build.gradle@@ -19,7 +19,7 @@ androID {         androIDTest.setRoot('tests')     }     defaultConfig {-        minSdkVersion 15+        minSdkVersion 16         targetSdkVersion 28         versionCode 1         versionname "1.0"@@ -65,8 +65,8 @@ dependencIEs {     natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"     natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"     implementation "com.androID.billingclIEnt:billing:$playBillinglibVersion"-    implementation "com.Google.firebase:firebase-core:16.0.3"-    implementation "com.Google.firebase:firebase-ads:15.0.1"+    implementation "com.Google.firebase:firebase-core:16.0.5"+    implementation "com.Google.firebase:firebase-ads:17.0.0"     implementation filetree(include: ['*.jar'], dir: 'libs')     testImplementation 'junit:junit:4.12'diff --git a/androID_instant_feature/build.gradle b/androID_instant_feature/build.gradleindex 30431c11..17c4ef27 100644--- a/androID_instant_feature/build.gradle+++ b/androID_instant_feature/build.gradle@@ -18,7 +18,7 @@ androID {     defaultConfig {         versionCode 4031         versionname "4.1.2.1i"-        minSdkVersion 15+        minSdkVersion 16         targetSdkVersion 28         multIDexEnabled true     }@@ -77,8 +77,8 @@ dependencIEs {     API 'com.androID.support:multIDex:1.0.3'     implementation "com.badlogicgames.gdx:gdx-backend-androID:$gdxVersion"     implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"-    implementation "com.Google.firebase:firebase-core:16.0.3"-    implementation 'com.Google.androID.gms:play-services-instantapps:16.0.0'+    implementation "com.Google.firebase:firebase-core:16.0.5"+    implementation 'com.Google.androID.gms:play-services-instantapps:16.0.1'     implementation filetree(dir: 'libs', include: ['*.jar']) }diff --git a/core/build.gradle b/core/build.gradleindex dd2640cf..5694a1da 100644--- a/core/build.gradle+++ b/core/build.gradle@@ -15,7 +15,7 @@ dependencIEs {     compile group: 'commons-io', name: 'commons-io', version: '2.6'     // https://mvnrepository.com/artifact/commons-codec/commons-codec     compile group: 'commons-codec', name: 'commons-codec', version: '1.11'-    compile 'com.Google.code.gson:gson:2.8.2'+    compile 'com.Google.code.gson:gson:2.8.5'     compile group: 'org.apache.commons', name: 'commons-text', version: '1.2'     compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'     compile group: 'org.jetbrains', name: 'annotations', version: '16.0.1'@@ -23,7 +23,7 @@ dependencIEs {     implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"     testCompile 'junit:junit:4.12'-    testCompile 'org.mockito:mockito-core:2.7.22'+    testCompile 'org.mockito:mockito-core:2.8.9'     testCompile group: 'org.powermock', name: 'powermock-API-mockito2', version: '1.7.3'     testCompile group: 'org.powermock', name: 'powermock-module-junit4', version: '1.7.3' }

请注意,其中的某些更改(如minSDKVersion)可以作为错误源丢弃.似乎最有可能与firebase有关.为什么?好吧,在Stackoverflow中还存在其他问题,但是所有这些中提出的解决方案都是将firebase依赖关系更新到最新版本,但是将firebase依赖关系更新到最新版本似乎是导致问题的原因.在我的项目中!使用旧版本,它可以正常运行.

这些是涉及的Gradle脚本的内容(我已经用’com.myapp.ID’替换了实际的applicationID)

:核心

apply plugin: "java"targetCompatibility = 1.8sourceCompatibility = 1.8[compileJava, compileTestJava]*.options*.enCoding = 'UTF-8'sourceSets.main.java.srcDirs = ["src/main"]sourceSets.test.java.srcDirs = ["src/test"]dependencIEs {    compile 'commons-io:commons-io:2.6'    compile 'commons-codec:commons-codec:1.11'    compile 'com.Google.code.gson:gson:2.8.5'    compile 'org.apache.commons:commons-text:1.2'    compile 'org.apache.commons:commons-collections4:4.1'    compile 'org.jetbrains:annotations:16.0.1'    compile "com.badlogicgames.gdx:gdx:1.9.9-SNAPSHOT"    compile "com.badlogicgames.gdx:gdx-freetype:1.9.9-SNAPSHOT"    testCompile 'junit:junit:4.12'    testCompile 'org.mockito:mockito-core:2.8.9'    testCompile 'org.powermock:powermock-API-mockito2:1.7.3'    testCompile 'org.powermock:powermock-module-junit4:1.7.3'}repositorIEs {    mavenCentral()}jar {    duplicatesstrategy = Duplicatesstrategy.EXCLUDE}

:androID_common

apply plugin: "com.androID.feature"configurations { natives }androID {    baseFeature true    compileSdkVersion 28    sourceSets {        main {            manifest.srcfile 'AndroIDManifest.xml'            java.srcDirs = ['src']            aIDl.srcDirs = ['src']            renderscript.srcDirs = ['src']            res.srcDirs = ['res']            assets.srcDirs = ['assets']            jnilibs.srcDirs = ['libs']        }        androIDTest.setRoot('tests')    }    defaultConfig {        minSdkVersion 16        targetSdkVersion 28        versionCode 1        versionname "1.0"        testInstrumentationRunner "androID.support.test.runner.AndroIDJUnitRunner"        sourceSets {            all {                manifest.srcfile "AndroIDManifest.xml"            }        }        multIDexEnabled true    }    buildTypes {        release {            setMinifyEnabled false            proguardfiles getDefaultProguardfile('proguard-androID.txt'), 'proguard-rules.pro'        }    }    buildToolsversion '28.0.2'    lintoptions {        abortOnError false    }    dexOptions {        jumboMode true    }}dependencIEs {    application project(':androID')    feature project(':androID_instant_feature')    API project(':core')    API 'com.androID.support:multIDex:1.0.3'    implementation "com.badlogicgames.gdx:gdx-backend-androID:1.9.9-SNAPSHOT"    natives "com.badlogicgames.gdx:gdx-platform:1.9.9-SNAPSHOT:natives-armeabi"    natives "com.badlogicgames.gdx:gdx-platform:1.9.9-SNAPSHOT:natives-armeabi-v7a"    natives "com.badlogicgames.gdx:gdx-platform:1.9.9-SNAPSHOT:natives-arm64-v8a"    natives "com.badlogicgames.gdx:gdx-platform:1.9.9-SNAPSHOT:natives-x86"    natives "com.badlogicgames.gdx:gdx-platform:1.9.9-SNAPSHOT:natives-x86_64"    implementation "com.badlogicgames.gdx:gdx-freetype:1.9.9-SNAPSHOT"    natives "com.badlogicgames.gdx:gdx-freetype-platform:1.9.9-SNAPSHOT:natives-armeabi"    natives "com.badlogicgames.gdx:gdx-freetype-platform:1.9.9-SNAPSHOT:natives-armeabi-v7a"    natives "com.badlogicgames.gdx:gdx-freetype-platform:1.9.9-SNAPSHOT:natives-arm64-v8a"    natives "com.badlogicgames.gdx:gdx-freetype-platform:1.9.9-SNAPSHOT:natives-x86"    natives "com.badlogicgames.gdx:gdx-freetype-platform:1.9.9-SNAPSHOT:natives-x86_64"    implementation "com.androID.billingclIEnt:billing:dp-1"    implementation "com.Google.firebase:firebase-core:16.0.5"    implementation "com.Google.firebase:firebase-ads:17.0.0"    implementation filetree(include: ['*.jar'], dir: 'libs')    testImplementation 'junit:junit:4.12'    androIDTestImplementation 'com.androID.support.test:runner:1.0.2'    androIDTestImplementation 'com.androID.support.test.espresso:espresso-core:3.0.2'    implementation 'com.Google.guava:guava:24.0-androID'}task copyAndroIDNatives() {    file("libs/armeabi/").mkdirs();    file("libs/armeabi-v7a/").mkdirs();    file("libs/arm64-v8a/").mkdirs();    file("libs/x86_64/").mkdirs();    file("libs/x86/").mkdirs();    configurations.natives.files.each { jar ->        def outputDir = null        if (jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")        if (jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")        if (jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi")        if (jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64")        if (jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")        if (outputDir != null) {            copy {                from zipTree(jar)                into outputDir                include "*.so"            }        }    }}

:机器人

apply plugin: "com.androID.application"apply plugin: 'io.fabric' // Needed by crashlytics. DO NOT REMOVE.androID {    buildToolsversion "28.0.2"    compileSdkVersion 28    sourceSets {        main {            manifest.srcfile 'AndroIDManifest.xml'            java.srcDirs = ['src']            aIDl.srcDirs = ['src']            renderscript.srcDirs = ['src']            res.srcDirs = ["${project(':androID_common').projectDir}/res"]            assets.srcDirs = ['assets']            jnilibs.srcDirs = ['libs']        }        androIDTest.setRoot('tests')    }    defaultConfig {        applicationID "com.myapp.ID"        versionCode 4032        versionname "4.1.2.1"        minSdkVersion 16        targetSdkVersion 28        multIDexEnabled true    }    dexOptions {        jumboMode true    }    // Proguard configuration    buildTypes {        release {            //MinifyEnabled true will turn proguard ON            MinifyEnabled true            //proguardfiles let you add your own proguard rules ('proguard-project.txt') in this case, as its already created by gdx-setup            proguardfiles getDefaultProguardfile('proguard-androID.txt'), 'proguard-project.txt'        }    }    compileOptions {        sourceCompatibility JavaVersion.VERSION_1_8        targetCompatibility JavaVersion.VERSION_1_8    }    productFlavors {    }    lintoptions {        abortOnError false    }}task importPuzzles(type: Exec) {    // Todo}task run(type: Exec) {    def path    def localPropertIEs = project.file("../local.propertIEs")    if (localPropertIEs.exists()) {        PropertIEs propertIEs = new PropertIEs()        localPropertIEs.withinputStream { instr ->            propertIEs.load(instr)        }        def sdkDir = propertIEs.getProperty('sdk.dir')        if (sdkDir) {            path = sdkDir        } else {            path = "$System.env.ANDROID_HOME"        }    } else {        path = "$System.env.ANDROID_HOME"    }    def adb = path + "/platform-tools/adb"    commandline "$adb", 'shell', 'am', 'start', '-n', 'com.myapp.ID/com.myapp.ID.AndroIDLauncher'}dependencIEs {    implementation project(":androID_common")    API 'com.androID.support:multIDex:1.0.3'    implementation "com.badlogicgames.gdx:gdx-backend-androID:1.9.9-SNAPSHOT"    implementation "com.badlogicgames.gdx:gdx-freetype:1.9.9-SNAPSHOT"    implementation "com.androID.billingclIEnt:billing:dp-1"    implementation "com.Google.firebase:firebase-core:16.0.5"    implementation "com.Google.firebase:firebase-ads:17.0.0"    implementation 'com.crashlytics.sdk.androID:crashlytics:2.9.5'    implementation filetree(include: ['*.jar'], dir: 'libs')}// ADD THIS AT THE BottOMapply plugin: 'com.Google.gms.Google-services'

:androID_instant_feature

apply plugin: "com.androID.feature"androID {//    baseFeature true    buildToolsversion "28.0.2"    compileSdkVersion 28    sourceSets {        main {            manifest.srcfile 'AndroIDManifest.xml'            java.srcDirs = ['src']            aIDl.srcDirs = ['src']            renderscript.srcDirs = ['src']            res.srcDirs = ["${project(':androID_common').projectDir}/res"]            assets.srcDirs = ['assets']            jnilibs.srcDirs = ['libs']        }    }    defaultConfig {        versionCode 4031        versionname "4.1.2.1i"        minSdkVersion 16        targetSdkVersion 28        multIDexEnabled true    }    dexOptions {        jumboMode true    }    // Proguard configuration    buildTypes {        release {            //MinifyEnabled true will turn proguard ON//            MinifyEnabled true            //proguardfiles let you add your own proguard rules ('proguard-project.txt') in this case, as its already created by gdx-setup//            proguardfiles getDefaultProguardfile('proguard-androID.txt'), 'proguard-project.txt'        }        deBUG {}    }    compileOptions {        sourceCompatibility JavaVersion.VERSION_1_8        targetCompatibility JavaVersion.VERSION_1_8    }    productFlavors {    }    lintoptions {        abortOnError false    }}task run(type: Exec) {    def path    def localPropertIEs = project.file("../local.propertIEs")    if (localPropertIEs.exists()) {        PropertIEs propertIEs = new PropertIEs()        localPropertIEs.withinputStream { instr ->            propertIEs.load(instr)        }        def sdkDir = propertIEs.getProperty('sdk.dir')        if (sdkDir) {            path = sdkDir        } else {            path = "$System.env.ANDROID_HOME"        }    } else {        path = "$System.env.ANDROID_HOME"    }    def adb = path + "/platform-tools/adb"    commandline "$adb", 'shell', 'am', 'start', '-n', 'com.myapp.ID/com.myapp.ID.AndroIDLauncher'}dependencIEs {    implementation project(":androID_common")    API 'com.androID.support:multIDex:1.0.3'    implementation "com.badlogicgames.gdx:gdx-backend-androID:1.9.9-SNAPSHOT"    implementation "com.badlogicgames.gdx:gdx-freetype:1.9.9-SNAPSHOT"    implementation "com.Google.firebase:firebase-core:16.0.5"    implementation 'com.Google.androID.gms:play-services-instantapps:16.0.1'    implementation filetree(dir: 'libs', include: ['*.jar'])}// ADD THIS AT THE BottOMapply plugin: 'com.Google.gms.Google-services'

最后,这是我项目的结构.与androID相关的最相关的部分是顶部.下面我只展示它与核心模块的关系.

这是一个libGDX游戏,我正在使用IntelliJ IDea,尽管这无关紧要,因为我在命令行中使用./gradlew构建时遇到这些错误.

编辑:我按照TWL的建议将firebase-core从16.0.5降级到16.0.4,并且可以正常工作,因此,我认为这是可以接受的解决方法,至少在firebase家伙发布了firebase-core 16.0.6或与之实际兼容的情况下firebase-ads 17.0.0.问题似乎有效地在于,firebase-ads 17.0.0依赖于导致错误的较旧版本的库.

查看以下依赖项输出:

这是我用firebase-core 16.0.4得到的:

$./gradlew androID_common:dependencIEs | grep measurement-base<-------------> 0% EXECUTING [0s]> :androID_common:dependencIEs|    |    |    +--- com.Google.androID.gms:play-services-measurement-base:16.0.3|    |    |    |    +--- com.Google.androID.gms:play-services-measurement-base:16.0.3|    |    +--- com.Google.androID.gms:play-services-measurement-base:16.0.3|         +--- com.Google.androID.gms:play-services-measurement-base:16.0.3|    |    |         \--- com.Google.androID.gms:play-services-measurement-base:16.0.3|    |    |    +--- com.Google.androID.gms:play-services-measurement-base:16.0.3|    |    |    |    +--- com.Google.androID.gms:play-services-measurement-base:16.0.3|    |    +--- com.Google.androID.gms:play-services-measurement-base:16.0.3|         +--- com.Google.androID.gms:play-services-measurement-base:16.0.3|    |    |         \--- com.Google.androID.gms:play-services-measurement-base:16.0.3|    |    |    +--- com.Google.androID.gms:play-services-measurement-base:16.0.3|    |    |    |    +--- com.Google.androID.gms:play-services-measurement-base:16.0.3|    |    +--- com.Google.androID.gms:play-services-measurement-base:16.0.3|         +--- com.Google.androID.gms:play-services-measurement-base:16.0.3

…(依此类推,所有16.0.3都直接输入)

而对于firebase-core 16.0.5:

$./gradlew androID_common:dependencIEs | grep measurement-base<-------------> 0% EXECUTING [1s]> :androID_common:dependencIEs > Resolve dependencIEs of :androID_common:releaseUnitTestRuntimeClasspath|    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4|    |    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|         +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    |         \--- com.Google.androID.gms:play-services-measurement-base:16.0.3 -> 16.0.4 (*)|    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4|    |    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|         +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    |         \--- com.Google.androID.gms:play-services-measurement-base:16.0.3 -> 16.0.4 (*)|    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4|    |    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|         +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    |         \--- com.Google.androID.gms:play-services-measurement-base:16.0.3 -> 16.0.4 (*)|    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4|    |    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|         +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    |         \--- com.Google.androID.gms:play-services-measurement-base:16.0.3 -> 16.0.4 (*)|    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4|    |    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|         +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    |         \--- com.Google.androID.gms:play-services-measurement-base:16.0.3 -> 16.0.4 (*)|    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4|    |    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|         +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    |         \--- com.Google.androID.gms:play-services-measurement-base:16.0.3 -> 16.0.4 (*)|    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4|    |    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|         +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    |         \--- com.Google.androID.gms:play-services-measurement-base:16.0.3 -> 16.0.4 (*)|    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4|    |    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|         +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    |         \--- com.Google.androID.gms:play-services-measurement-base:16.0.3 -> 16.0.4 (*)|    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4|    |    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|         +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    |         \--- com.Google.androID.gms:play-services-measurement-base:16.0.3 -> 16.0.4 (*)|    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4|    |    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|         +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    |         \--- com.Google.androID.gms:play-services-measurement-base:16.0.3 -> 16.0.4 (*)|    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4|    |    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|         +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    |         \--- com.Google.androID.gms:play-services-measurement-base:16.0.3 -> 16.0.4 (*)|    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4|    |    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|         +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    |         \--- com.Google.androID.gms:play-services-measurement-base:16.0.3 -> 16.0.4 (*)|    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4|    |    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|         +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    |         \--- com.Google.androID.gms:play-services-measurement-base:16.0.3 -> 16.0.4 (*)|    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4|    |    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|         +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    |         \--- com.Google.androID.gms:play-services-measurement-base:16.0.3 -> 16.0.4 (*)|    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4|    |    |    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)|    |    +--- com.Google.androID.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)

如您所见,有些条目“ com.Google.androID.gms:play-services-measurement-base:16.0.3-> 16.0.4(*)”尽管我并不擅长解释这些条目,我认为这是造成问题的原因.

解决方法:

好吧,既然所有评论都移到了聊天中,并且我的临时解决方法也在那里,那么这里是:

您的错误消息使我的搜索达到com.android.tools.r8.errors.CompilationError: Program type already present: androidx.annotation.AnimRes

Caused by:
com.androID.builder.multIDex.D8MainDexList$MainDexListException:
com.androID.tools.r8.errors.CompilationError: Program type already
present: ___

该错误表明某个地方存在重复的依赖关系,该依赖关系运行于两个不同的版本.然后的目标是运行./gradlew app:dependencIEs以生成依赖项的树/列表以查找com.Google.androID.gms.internal.measurement.zzdz.问题在于,这是一个模糊的内部私有包,因此无法在列表中直接找到它,但是关键字Measurement只是一个提示.

这使我注意到核心和广告具有相似之处:play-services-measurement-API:[16.0.3]-> 16.0.3(*)和play-services-measurement-sdk-API:16.0.2.通过测试,我发现了两种解决方法:

>将com.Google.firebase:firebase-core:16.0.5降级为16.0.4
>将排除组:“ com.Google.androID.gms”,模块:“ play-services-measurement-sdk-API”添加到广告依赖项

第一种选择可能更安全,因为重新运行./gradlew app:dependencIEs显示play-services-measurement-API和play-services-measurement-sdk-API现在都为16.0.2.

而且我确定Google / Firebase知道了这一点,因为我在https://issuetracker.google.com/issues/119213680处又找到了它.翻译是:错误是zzdz类的重复,zzdz类的存在状态的转换如下.因此,请注意play-services-measurement-sdk-API可能会遇到其他Firebase / GMS库的问题.应该有一个即将发布的修复程序来更新它.

*请注意,即使切换到“ com.Google.firebase:firebase-ads:17.1.0”仍会导致此错误.

总结

以上是内存溢出为你收集整理的java-更新Gradle依赖项后生成错误.嫌疑犯#1是火力发源地全部内容,希望文章能够帮你解决java-更新Gradle依赖项后生成错误.嫌疑犯#1是火力发源地所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/web/1093581.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存