Ad

BuildPreBundle Failed Duplicate Entry: META-INF/MANIFEST.MF

- 1 answer

When I try to run my app on android < 8.0 I have this error java.util.zip.ZipException: duplicate entry: META-INF/MANIFEST.MF

I looked for the error and added the following to my build.gradle in the app module but without any success:

packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/proguard/androidx-annotations.pro'
        exclude 'META-INF/atomicfu.kotlin_module'
        exclude 'META-INF/MANIFEST.MF'
    }

Here's the full build.gradle if needed :

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'androidx.navigation.safeargs'

apply plugin: 'io.fabric'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.sbe.globalcare.pictures.upload"
        minSdkVersion 23
        targetSdkVersion 28
        versionCode 1
        versionName "1.1.5"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    flavorDimensions "version"
    productFlavors {
        demo {
            applicationIdSuffix ".demo"
            versionNameSuffix "-demo"
            dimension "version"
            signingConfig signingConfigs.config
        }

        full {
            dimension "version"
            applicationIdSuffix ".full"
            versionNameSuffix "-full"
        }


    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/proguard/androidx-annotations.pro'
        exclude 'META-INF/atomicfu.kotlin_module'
        exclude 'META-INF/MANIFEST.MF'
    }

    sourceSets {
        // Encapsulates configurations for the demo source set.
        demo {

            // If you list multiple directories, Gradle uses all of them to collect
            // sources. Because Gradle gives these directories equal priority, if
            // you define the same resource in more than one directory, you get an
            // error when merging resources. The default directory is 'src/main/res'.
//            res.srcDirs = ['src/demo/res']

            // Note: You should avoid specifying a directory which is a parent to one
            // or more other directories you specify. For example, avoid the following:
            // res.srcDirs = ['other/res1', 'other/res1/layouts', 'other/res1/strings']
            // You should specify either only the root 'other/res1' directory, or only the
            // nested 'other/res1/layouts' and 'other/res1/strings' directories.

            // For each source set, you can specify only one Android manifest.
            // By default, Android Studio creates a manifest for your main source
            // set in the src/main/ directory.
//            manifest.srcFile 'other/AndroidManifest.xml'
        }
    }
}

configurations {
    demoDebugImplementation
    demoReleaseImplementation
    fullDebugImplementation
    fullReleaseImplementation
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'com.budiyev.android:code-scanner:2.1.0'
    implementation 'com.pubnub:pubnub-gson:4.21.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-android-extensions'
    apply plugin: 'kotlin-kapt'
    apply plugin: 'io.fabric'
    implementation 'com.squareup.retrofit2:retrofit:2.5.0'
    implementation 'com.squareup.moshi:moshi:1.8.0'

    //glide
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    kapt 'com.github.bumptech.glide:compiler:4.8.0'

    //moshi
    implementation 'com.squareup.retrofit2:converter-moshi:2.5.0'
    kapt 'com.squareup.moshi:moshi-kotlin-codegen:1.6.0'

    implementation 'commons-io:commons-io:2.4'
    implementation 'com.github.simonpercic:oklog3:2.3.0'
    implementation 'com.jakewharton.timber:timber:4.7.1'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.github.lzyzsd:circleprogress:1.2.1'
    implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0'
    implementation 'com.afollestad.material-dialogs:core:2.0.0'
    implementation 'com.afollestad.material-dialogs:input:2.0.0'
    implementation 'com.afollestad.material-dialogs:files:2.0.0'
    implementation 'com.afollestad.material-dialogs:color:2.0.0'
    implementation 'org.eclipse.birt.runtime.3_7_1:org.apache.xerces:2.9.0'

    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'

    demoImplementation 'com.readystatesoftware.chuck:library-no-op:1.1.0' //disable logging on demo profile

    fullDebugImplementation 'com.readystatesoftware.chuck:library:1.1.0'
    fullReleaseImplementation 'com.readystatesoftware.chuck:library-no-op:1.1.0'

    def nav_version = "2.1.0-alpha05"

    implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" // For Kotlin use navigation-fragment-ktx
    implementation "androidx.navigation:navigation-ui-ktx:$nav_version" // For Kotlin use navigation-ui-ktx

    implementation 'com.github.nikartm:image-support:1.0.5'


    implementation 'com.camerakit:camerakit:1.0.0-beta3.11'
    implementation 'com.camerakit:jpegkit:0.1.0'
    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.2.0'

    implementation "com.priyankvasa.android:cameraview-ex:3.5.3-alpha"

    implementation('com.crashlytics.sdk.android:crashlytics:[email protected]') {
        transitive = true
    }

    implementation 'com.codesgood:justifiedtextview:1.1.0'

}
Ad

Answer

this problem happened to me when I update build Gradle version to 3.5.2 so I downgrade version to

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

and all thig work perfectly.

Ad
source: stackoverflow.com
Ad