Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
497 views
in Technique[技术] by (71.8m points)

android - Can't generate signed apk because gradle failes for task ':app:packageDebug'

I can't generate a signed release apk due to the following error in Gradle built.

Execution failed for task ':app:packageDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Entry name 'kotlin/collections/MapWithDefault.kotlin_metadata' collided

but there is no problem with running my app on a device. I have tried invalidating caches and restarting, deleting old generated debug/release apks. One additional action I have done in Gradle is that, I have applicationIdSuffix, versionNameSuffix, and sperate name for debug and release builds. My Gradle buildTypes for app module goes like this

buildTypes {
        release {
            resValue "string", "app_name", "@string/app_name_release"
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        debug {
            versionNameSuffix ".debug"
            applicationIdSuffix = ".debug"
            resValue "string", "app_name", "@string/app_name_debug"
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
question from:https://stackoverflow.com/questions/65832351/cant-generate-signed-apk-because-gradle-failes-for-task-apppackagedebug

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Change the build variant from "debug" to "release"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...