生成项目时,任务“:app:mergeExtDexDebug”执行失败

Execution failed for task ':app:mergeExtDexDebug' when building a project

提问人:paulme 提问时间:8/10/2022 最后编辑:paulme 更新时间:8/10/2022 访问量:589

问:

生成项目时出现以下错误:

* What went wrong:

任务“:app:mergeExtDexDebug”执行失败。

无法解析配置“:app:debugRuntimeClasspath”的所有文件。 无法将 play-services-ads-11.0.1.aar (com.google.android.gms:play-services-ads:11.0.1) 转换为匹配属性 {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}。 > DexingWithClasspathTransform: /Users/pavelkiruhin/.gradle/caches/transforms-3/bc9f963676e4faed6b0c0af40d264d92/transformed/jetified-play-services-ads-11.0.1-runtime.jar执行失败。 > dexing 时出错。

我已经尝试过:清理项目、重建项目、使缓存失效、删除“.gradle”文件夹、重新安装 Android Studio

我的build.gradle(模块)

        plugins {
        id 'com.android.application'
        id 'com.google.gms.google-services'
        id 'com.google.firebase.crashlytics'
        id 'kotlin-android'
    }
    
    android {
        compileSdkVersion 32
        buildToolsVersion "30.0.3"
    
        defaultConfig {
            applicationId 'com.pavloffmedev.dcn'
            minSdkVersion 21
            targetSdkVersion 32
            versionCode 90
            versionName "3.10 beta 4"
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
            vectorDrawables {
                useSupportLibrary true
            }
        }
    
        buildFeatures {
            viewBinding true
            compose true
        }
        composeOptions {
            kotlinCompilerExtensionVersion = "$compose_version"
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
    
        kotlinOptions {
            jvmTarget = '1.8'
        }
            packagingOptions {
                resources {
                    excludes += '/META-INF/{AL2.0,LGPL2.1}'
                }
            }
        }
        
        dependencies {
        
            implementation 'androidx.core:core-ktx:1.8.0'
            implementation 'androidx.appcompat:appcompat:1.4.2'
            implementation 'com.google.android.material:material:1.6.1'
            implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
            implementation 'androidx.legacy:legacy-support-v4:1.0.0'
            implementation 'com.google.firebase:firebase-messaging:23.0.7'
            implementation 'com.google.firebase:firebase-crashlytics-ktx:18.2.12'
            implementation 'com.google.firebase:firebase-analytics-ktx:21.1.0'
            implementation 'com.google.firebase:firebase-messaging-ktx:23.0.7'
            implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
            implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
            implementation 'androidx.activity:activity-compose:1.5.1'
            testImplementation 'junit:junit:4.13.2'
            androidTestImplementation 'androidx.test.ext:junit:1.1.3'
            androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
            implementation 'com.google.android.play:core:1.10.3'
            implementation 'com.android.volley:volley:1.2.1'
            implementation 'com.google.android.gms:play-services-auth:20.2.0'
            androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
            apply plugin: 'com.android.application'
            apply plugin: 'kotlin-android'
            apply plugin: 'kotlin-android-extensions'
            implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'
            implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
            implementation 'com.adcolony:sdk:4.8.0'
            implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
            implementation 'c
    
    om.pollfish:pollfish-googleplay:6.2.5'
        implementation 'com.google.code.gson:gson:2.9.1'
        implementation 'com.squareup.picasso:picasso:2.71828'
        implementation 'com.adscendmedia.sdk:adscendmedia:2.3.9'
        implementation 'androidx.core:core-ktx:1.8.0'
        implementation 'io.getstream:avatarview-coil:1.0.6'
        implementation 'com.github.PsssUm:upmob-api:0.2.6'
        implementation 'com.gitlab.adgate-media:androidsdk:2.1.1'
        implementation 'com.airbnb.android:lottie:5.2.0'
        implementation 'com.facebook.shimmer:shimmer:0.5.0'
        implementation files('../libs/unity-ads.aar')
        implementation"androidx.compose.compiler:compiler:$compose_version"
        implementation "androidx.compose.foundation:foundation:$compose_version"
        implementation "androidx.compose.material:material:$compose_version"
            implementation "androidx.compose.runtime:runtime:$compose_version"
            implementation "androidx.compose.ui:ui:$compose_version"
            debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
            debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
            implementation "androidx.compose.material3:material3:1.0.0-alpha15"
        }
        repositories {
            mavenCentral()
        }

我的build.gradle(项目)

buildscript {
    ext.kotlin_version = '1.7.0'
    ext.compose_version = "1.2.0"

    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.2'
        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0'
        classpath 'com.google.gms:google-services:4.3.13'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url "https://bitbucket.org/adscend/androidsdk/raw/master/" }
        maven {
            url 'https://jitpack.io'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
android gradle android-gradle-plugin build.gradle google-play-services

评论

0赞 Daniel Ochoa 10/19/2022
我有同样的问题。你有没有想出一个解决方案?
0赞 paulme 10/20/2022
不,我必须重新安装 Android Studio

答: 暂无答案