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

一曲冷凌霜 提交于 2020-12-12 11:19:11

问题


I needed android-image-cropper library for my android app and so i added it to the gradle dependency. After syncing, a number of errors were showing up.

Here's one and the gradle won't fix:

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

And my build.gradle from the app is:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "asif.com.firebasedemo.activity"
        minSdkVersion 18
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        debug {

            resValue 'string', "FACEBOOK_APP_ID", FirebaseAuthenticationSample_FACEBOOK_APP_ID
            resValue 'string', "FB_LOGIN_PROTOCOL_SCHEME", FirebaseAuthenticationSample_FB_LOGIN_PROTOCOL_SCHEME
            buildConfigField 'String', "DEFAULT_WEB_CLIENT_ID", FirebaseAuthenticationSample_DEFAULT_WEB_CLIENT_ID

        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

            resValue 'string', "FACEBOOK_APP_ID", FirebaseAuthenticationSample_FACEBOOK_APP_ID
            resValue 'string', "FB_LOGIN_PROTOCOL_SCHEME", FirebaseAuthenticationSample_FB_LOGIN_PROTOCOL_SCHEME
            buildConfigField 'String', "DEFAULT_WEB_CLIENT_ID", FirebaseAuthenticationSample_DEFAULT_WEB_CLIENT_ID
        }
    }
    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.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'

    //firebase libraries

//    compile 'com.google.firebase:firebase-messaging:17.3.4'     //firebase cloud messaging

    implementation 'com.google.firebase:firebase-auth:16.0.4'
    implementation 'com.google.firebase:firebase-storage:16.0.4'
    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.google.firebase:firebase-database:16.0.4' // Realtime Database
    implementation 'com.google.firebase:firebase-auth:16.0.4'// Email Password based authentication
    implementation 'com.google.android.gms:play-services-auth:16.0.1'// google sign in integration
    implementation 'com.facebook.android:facebook-login:4.38.0'// facebook integration


    implementation 'com.intuit.ssp:ssp-android:1.0.6'// for text size
    implementation 'com.intuit.sdp:sdp-android:1.0.6'// for layout size

    implementation 'com.android.support:design:28.0.0'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
}
apply plugin: 'com.google.gms.google-services'

I don't know what is wrong here and could not figure it out what causes the issues to be occurred. I searched a little bit and find some other solution to other type of errors similar to this, but didn't help at all.

Could anyone suggests what is really wrong here and what needs to be fixed?

Any regarding advices/suggestions would be very much helpful. Thanks in advance.


回答1:


Try this instead

api 'com.theartofdev.edmodo:android-image-cropper:2.7.0'




回答2:


You could do something like this in your build.gradle

       android.packagingOptions {
          exclude 'META-INF/androidx.localbroadcastmanager_localbroadcastmanager.version'
        }


来源:https://stackoverflow.com/questions/53310527/gradle-error-more-than-one-file-was-found-with-os-independent-path-meta-inf-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!