简体   繁体   English

运行项目Firebase电话身份验证时如何解决此错误

[英]How to fix this error when I run project firebase phone authentication

I use this dependencies 我用这个依赖

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

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. 错误:任务':app:transformResourcesWithMergeJavaResForDebug'的执行失败。

com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.properties 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\\exploded-aar\\com.google.android.gms\\play-services-basement\\11.4.2\\jars\\classes.jar com.android.build.api.transform.TransformException:com.android.builder.packaging.DuplicateFileException:在APK META-INF / maven / com.fasterxml.jackson.core / jackson-core / pom.properties 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文件2:D: \\ eRozgaar \\ app \\ build \\ intermediates \\ exploded-aar \\ com.google.android.gms \\ play-services-basement \\ 11.4.2 \\ jars \\ classes.jar

my build.gradil is : 我的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'

}

You can try to add the following line to the bottom in your app's build.gradle , inside the android {} and below your dependencies {} . 您可以尝试build.gradle添加到应用程序的build.gradle的底部, android {}dependencies {}

packagingOptions {
    exclude 'META-INF/maven'
}

This will remove unnecessary files during your build, which should prevent your duplicate file exception which is caused by merging your dependencies. 这将在构建期间删除不必要的文件,这应避免由于合并依赖项而导致的重复文件异常。

See: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.fasterxml.jackson.core/jackson-databind/pom.xml 请参阅: com.android.builder.packaging.DuplicateFileException:在APK META-INF / maven / com.fasterxml.jackson.core / jackson-databind / pom.xml中复制的重复文件

Solution of my problem was 解决我的问题是

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'
}

duplicate file link copy from error message and past in 错误消息和过去的重复文件链接副本

packagingOptions 
{ 
 exclude 'past here copied file link'
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我已经在 firebase 项目设置调试以及游戏控制台上添加了指纹,但是电话身份验证不起作用如何解决这个问题? - I have added fingerprint on firebase project setting debug as well as playconsole but the Phone Authentication not working how to fix this? 如何在我运行 flutter 项目时修复“已完成错误:Gradle 任务 assembleDebug 失败,退出代码 -1”错误 - How to fix “Finished with error: Gradle task assembleDebug failed with exit code -1” error when i run flutter project 如何将 Firebase 电话身份验证与电子邮件/密码身份验证联系起来? - How Can I Link Firebase Phone Authentication with Email/Password Authentication? 尝试在我的 Android 应用程序项目中添加电话身份验证时出现错误 - I am getting error when trying to add phone authentication in my Android app project 每次尝试运行此应用程序时,如何解决在手机上显示的运行时错误? - How Can I Fix This Runtime Error Being Displayed On My Phone each Time I Try To Run This Application? 如何让 Firebase 电话身份验证适用于我的应用? - How do I get Firebase Phone Authentication to work for my app? 如何修复firebase身份验证中的错误“电子邮件地址格式错误”? - How to fix the error “the email address is badly formatted” in firebase authentication? 如何修复 firebase 注册认证? - How to fix the firebase signup authentication? 如何在Firebase电话身份验证中修复SMS权限? 清单中没有提及要删除的权限 - How to fix SMS permissions in Firebase phone authentication? There are no permissions mentioned in manifest to remove 如何在Firebase身份验证中修复空指针异常? - How can i fix null pointer exception in Firebase Authentication?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM