如何在运行项目firebase电话身份验证时修复此错误

时间:2017-10-22 17:49:25

标签: android firebase-authentication

我使用此依赖项

compile 'com.google.firebase:firebase-auth:11.4.2'
Error:

错误:任务':app:transformResourcesWithMergeJavaResForDebug'的执行失败。

  

com.android.build.api.transform.TransformException:com.android.builder.packaging.DuplicateFileException:在APK META-INF / maven / com.fasterxml.jackson.core / jackson-core / pom中复制的重复文件。性能       File1:C:\ Users \ Usman.gradle \ caches \ modules-2 \ files-2.1 \ com.fasterxml.jackson.core \ jackson-core \ 2.2.2 \ d20be6a5ddd6f8cfd36ebf6dea329873a1c41f1b \ jackson-core-2.2.2.jar       File2:D:\ eRozgaar \ app \ build \ intermediates \ explosion-aar \ com.google.android.gms \ play-services-basement \ 11.4.2 \ jars \ classes.jar

我的build.gradil是:

 apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"


defaultConfig {
    applicationId "com.example.usman.erozgaar"
    minSdkVersion 21
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),  
        'proguard-rules.pro'

    }
}
packagingOptions
        {

    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LGPL2.1'

      }

    }

dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.firebase:firebase-client-android:2.5.2+'
compile 'com.google.firebase:firebase-core:11.4.2'
compile 'com.android.volley:volley:1.0.0'
//    compile 'com.google.firebase:firebase-core:10.0.1'
//    compile 'com.firebase:firebase-ui-storage:0.6.0'
compile 'com.google.firebase:firebase-auth:11.4.2'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.google.firebase:firebase-database:11.0.1'
compile 'com.google.firebase:firebase-storage:11.0.1'

}

2 个答案:

答案 0 :(得分:0)

您可以尝试在应用build.gradle内,android {}内以及dependencies {}下方添加以下行。

packagingOptions {
    exclude 'META-INF/maven'
}

这将在构建期间删除不必要的文件,这可以防止因合并依赖项而导致的重复文件异常。

请参阅:com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.fasterxml.jackson.core/jackson-databind/pom.xml

答案 1 :(得分:0)

解决我的问题是

packagingOptions 
{
exclude 'META-INF/maven/com.fasterxml.jackson.core/jackson-
core/pom.properties'
exclude 'META-INF/services/com.fasterxml.jackson.core.JsonFactory'
exclude 'META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.xml'
}

重复文件链接副本从错误消息和过去

packagingOptions 
{ 
 exclude 'past here copied file link'
}