Gradle duplicate entry error: META-INF/MANIFEST.MF (Or how to delete a file from jar)

后端 未结 5 1369
醉酒成梦
醉酒成梦 2020-12-20 11:34

I\'ve cloned a github repository because I wanted to study the code, but when I tried to build it in Android Studio, I ran into some trouble. After adding the google maven r

相关标签:
5条回答
  • 2020-12-20 11:52

    as @rubo77 says and after my confirmation:

    • Latest solution
      • Upgrade gradle version
        • eg:
          • from 3.5.2 to 3.5.3
          • from 3.5.2 to 3.5.4
    • Obsolete solution:
      • downgrade from 3.5.2 to 3.5.1

    my choice is : upgrade from 3.5.2 to 3.5.4

    build.gradle:

        dependencies {
    //        classpath 'com.android.tools.build:gradle:3.5.2'
    //        classpath 'com.android.tools.build:gradle:3.5.3'
            classpath 'com.android.tools.build:gradle:3.5.4'
        }
    

    gradle 3.5.4

    0 讨论(0)
  • 2020-12-20 11:54

    As Rajen Raiyarela said, go to File->Project Structure->Project->Android Gradle Plugin Version and downgrade it from 3.5.2 to 3.5.1.

    0 讨论(0)
  • 2020-12-20 11:55

    This issue is happening because of duplicate dependencies.
    Check for multiple dependencies in the Gradle app.

    0 讨论(0)
  • 2020-12-20 12:01

    Either package it once or not at all:

    android {
        packagingOptions {
            pickFirst "META-INF/MANIFEST.MF"
            // exclude "META-INF/MANIFEST.MF"
        }
    }
    
    0 讨论(0)
  • 2020-12-20 12:03

    Set project dependencies to:

    classpath 'com.android.tools.build:gradle:3.5.3'
    

    or latest one.

    Note: by doing this, my problem has been resolved.

    0 讨论(0)
提交回复
热议问题