使用操作系统独立路径“ META-INF / androidx.localbroadcastmanager_localbroadcastmanager.version”找到了多个文件

时间:2019-02-25 04:19:30

标签: android firebase kotlin androidx

我不知道我的应用程序正在发生什么。我认为我的build.gradle中的应用出现了问题:

这是错误:

  

发现多个文件具有与操作系统无关的路径   'META-INF / androidx.localbroadcastmanager_localbroadcastmanager.version'

还有我的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'

有人可以建议解决方案吗?我尝试了一些解决方案,但没有一个解决我的问题。

预先感谢

3 个答案:

答案 0 :(得分:0)

将这些行添加到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'
    }
}

答案 1 :(得分:0)

将这些行添加到build.gradle的PackagingOptions中

givenThat(any(anyUrl()).withHeader("SOAPAction", equalTo("\"Mystifly.OnePoint/OnePoint/AirRevalidate\""))
                .willReturn(aResponse().withStatus(200)
                .withBody("{ \"message\": \"Roma Barladyn - a great colleague!\" }")
                ));

答案 2 :(得分:0)

我通过升级 Android Gradle 插件和 Gradle 解决了这个问题。 之后重建项目,问题就解决了