2

I don't have an idea for what is going on on my app. I think there is something wrong in my build.gradle from the app:

Here is the error:

More than one file was found with OS independent path 'META-INF/androidx.localbroadcastmanager_localbroadcastmanager.version'

And my build.gradle app

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-kapt'


apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "id.alif.ngajiasik"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }


}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:exifinterface:28.0.0'
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.0"
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

    //firebase
    implementation 'com.google.firebase:firebase-auth:16.1.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.0'
    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.google.firebase:firebase-firestore:17.1.1'
    implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
    implementation 'com.firebaseui:firebase-ui-storage:4.3.1'
    implementation 'com.google.firebase:firebase-storage:16.0.5'

    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'

    implementation 'com.google.android.gms:play-services-location:15.0.1'

    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'
    implementation 'com.android.support:cardview-v7:28.0.0'

    // For developers using the Android Support Library
    implementation 'pub.devrel:easypermissions:2.0.1'

    //circle image
    implementation 'de.hdodenhof:circleimageview:3.0.0'

    //picasso for better image
    implementation 'com.squareup.picasso:picasso:2.71828'

    //anko
    implementation "org.jetbrains.anko:anko:$anko_version"
    implementation "org.jetbrains.anko:anko-design:$anko_version"
    implementation "org.jetbrains.anko:anko-coroutines:$anko_version"

    //glide for better picture
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    kapt "android.arch.lifecycle:compiler:1.1.1"
    kapt 'com.github.bumptech.glide:compiler:4.9.0'

    //groupie for better list
    implementation 'com.xwray:groupie:2.0.3'
    implementation 'com.xwray:groupie-kotlin-android-extensions:2.0.3'

    implementation 'androidx.recyclerview:recyclerview:1.0.0'

    kotlin {
        experimental {
            coroutines "enable"
        }
    }
    androidExtensions {
        experimental = true
    }


}


apply plugin: 'com.google.gms.google-services'

Can anyone suggest for a solution? I have tried some solutions, but none of them solve my problem.

Thanks in advance

KENdi
  • 7,576
  • 2
  • 16
  • 31
Alif Al-Gibran
  • 1,166
  • 1
  • 13
  • 24
  • Try [Excluding Meta-INF](https://stackoverflow.com/questions/44342455/more-than-one-file-was-found-with-os-independent-path-meta-inf-license) – ADM Feb 25 '19 at 04:21
  • i've tried that but it doesn't solve – Alif Al-Gibran Feb 25 '19 at 04:35
  • https://stackoverflow.com/questions/52518378/more-than-one-file-was-found-with-os-independent-path-meta-inf-proguard-android – ADM Feb 25 '19 at 04:37
  • thank you for your responses, but those aren't given me the solution, your solution is not in my case, i try to modification your solution but still doesn't work – Alif Al-Gibran Feb 25 '19 at 04:47

3 Answers3

7

add these lines in app/build.grade

android {
  packagingOptions {
        exclude 'META-INF/androidx.localbroadcastmanager_localbroadcastmanager.version'
        exclude 'META-INF/androidx.swiperefreshlayout_swiperefreshlayout.version'
        exclude 'META-INF/androidx.print_print.version'
        exclude 'META-INF/androidx.customview_customview.version'
        exclude 'META-INF/androidx.cursoradapter_cursoradapter.version'
        exclude 'META-INF/androidx.drawerlayout_drawerlayout.version'
        exclude 'META-INF/androidx.versionedparcelable_versionedparcelable.version'
        exclude 'META-INF/androidx.interpolator_interpolator.version'
        exclude 'META-INF/androidx.fragment_fragment.version'
        exclude 'META-INF/androidx.vectordrawable_vectordrawable.version'
        exclude 'META-INF/androidx.core_core.version'
        exclude 'META-INF/androidx.legacy_legacy-support-core-ui.version'
        exclude 'META-INF/androidx.legacy_legacy-support-core-utils.version'
        exclude 'META-INF/proguard/androidx-annotations.pro'
        exclude 'META-INF/androidx.slidingpanelayout_slidingpanelayout.version'
        exclude 'META-INF/androidx.print_print.version'
        exclude 'META-INF/androidx.documentfile_documentfile.version'
        exclude 'META-INF/androidx.versionedparcelable_versionedparcelable.version'
        exclude 'META-INF/androidx.asynclayoutinflater_asynclayoutinflater.version'
        exclude 'META-INF/androidx.drawerlayout_drawerlayout.version'
        exclude 'META-INF/androidx.interpolator_interpolator.version'
        exclude 'META-INF/androidx.appcompat_appcompat.version'
        exclude 'META-INF/androidx.swiperefreshlayout_swiperefreshlayout.version'
        exclude 'META-INF/androidx.loader_loader.version'
        exclude 'META-INF/androidx.viewpager_viewpager.version'
        exclude 'META-INF/androidx.coordinatorlayout_coordinatorlayout.version'
        exclude 'META-INF/androidx.cursoradapter_cursoradapter.version'
    }
}
Muhammad Numan
  • 23,222
  • 6
  • 63
  • 80
0

add these lines inside packagingOptions of build.gradle

exclude 'META-INF/androidx.*'
exclude 'META-INF/proguard/androidx-annotations.pro'
Ajay Chauhan
  • 1,471
  • 4
  • 17
  • 37
0

I solved it by upgrading the Android Gradle Plugin and the Gradle. After that rebuild the project and that problem solved

Dharman
  • 30,962
  • 25
  • 85
  • 135
Babak Karchini
  • 155
  • 1
  • 8