classes.jar' already contains entry 'META-INF/module_name_debug.kotlin_module', cannot overwrite

Viewed 1896

In project i am using kotlin dsl, jetpack compose, com.android.tools.build:gradle:7.0.0-alpha08, many modules and i am continuously getting this error.

Zip file 'E:\project_name\module_name\build\intermediates\compile_library_classes_jar\debug\classes.jar' already contains entry 'META-INF/module_name_debug.kotlin_module', cannot overwrite

Any combinations of exclude/pickFirst/merge

packagingOptions {
        exclude/pickFirst/merge("META-INF/module_name_debug.kotlin_module")
    } 

just doesnt work.

Is there some solution?

3 Answers

just delete the build ( E:\project_name\module_name\build ) folder and rebuild the project

If you are on Bumblebee and higher. Make project automatically(only works while not running/debugging) option has been removed.

Upgrading your project to use the latest version of gradle in build.gradle and gradle.properties should fix this error. For my current project I'm using this in build.gradle

classpath "com.android.tools.build:gradle:7.1.1"

gradle.properties

distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Related