gpt4 book ai didi

android - 如何解决android中的重复文件异常?

转载 作者:行者123 更新时间:2023-11-29 14:20:22 26 4
gpt4 key购买 nike

我正在尝试使用 Firebase 制作聊天应用程序。代码似乎没问题,但我在尝试运行项目时遇到了一个奇怪的错误。

这里是错误:

Error:FAILURE: Build failed with an exception.
Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException:com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE
File1: C:\Users\Aadesh\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.2.2\285cb9c666f0f0f3dd8a1be04e1f457eb7b15113\jackson-annotations-2.2.2.jar
File2: C:\Users\Aadesh\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.2.2\3c8f6018eaa72d43b261181e801e6f8676c16ef6\jackson-databind-2.2.2.jar
File3: C:\Users\Aadesh\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.2.2\d20be6a5ddd6f8cfd36ebf6dea329873a1c41f1b\jackson-core-2.2.2.jar


* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

可能是什么问题,我该如何解决?

Gradle 文件:

apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.aadesh.chatnow"
minSdkVersion 17
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.volley:volley:1.0.0'
testCompile 'junit:junit:4.12'
compile 'com.firebase:firebase-client-android:2.5.2'
}
apply plugin: 'com.google.gms.google-services'

最佳答案

你应该添加:

 android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}

到你的 build.gradle 文件。这将在合并库时跳过这些文件。

关于android - 如何解决android中的重复文件异常?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41845375/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com