java 如何修复 Android Studio 3.0 Beta-6 中的“在操作系统独立路径‘project.properties’中发现多个文件”错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46431090/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 09:12:47  来源:igfitidea点击:

How to fix "More than one file was found with OS independent path 'project.properties'" Error in Android Studio 3.0 Beta-6

javaandroidandroid-gradle-pluginbuild.gradleandroid-studio-3.0

提问by user8661677

I am using Android Gradle:3.0.0-beta-6 and it throws the following Error ever since I included Google Translation API.

我正在使用 Android Gradle:3.0.0-beta-6 并且自从我包含 Google Translation API 以来它抛出以下错误。

FAILURE: Build failed with an exception.

What went wrong: Execution failed for task 
':app:transformResourcesWithMergeJavaResForDebug'.

More than one file was found with OS independent path 'project.properties'

This is my dependencies

这是我的依赖

dependencies {
    annotationProcessor 'com.google.auto.value:auto-value:1.2'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-v4:26.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1',
 {
  exclude group: 'com.android.support', module: 'support-annotations'
    })
    api 'com.twitter.sdk.android:twitter-core:3.1.1'
    api 'com.google.cloud:google-cloud-translate:1.6.0'
}

How can I fix this error and why exactly this is happening because I searched exhaustively for last 34 hrs and I didn't get an explanation.

我该如何解决这个错误以及为什么会发生这种情况,因为我在过去 34 小时内进行了详尽的搜索,但没有得到任何解释。

回答by Bernardo Rocha

Have you tried adding this to your build.gradle?

您是否尝试将其添加到 build.gradle 中?

android {
    ...
    packagingOptions {
        exclude 'META-INF/project.properties'
    }
}