android studio中的com.android.builder.packaging.DuplicateFileException

时间:2017-11-13 09:55:23

标签: java android google-bigquery

我没有得到如何解决这个问题?谁能建议我一些解决方案

我的应用程序Gradle。

   apply plugin: 'com.android.application'

    android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.example.admin.bigquerytutorials"
        minSdkVersion 21
        targetSdkVersion 25
        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(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:25.0.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.cloud:google-cloud-bigquery:0.26.0-beta'
    }

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

  

com.android.build.api.transform.TransformException:com.android.builder.packaging.DuplicateFileException:在APK project.properties中复制的重复文件       File1:C:\ Users \ Admin.gradle \ caches \ modules-2 \ files-2.1 \ com.google.cloud \ google-cloud-bigquery \ 0.26.0-beta \ 69de62300e43f068fee504fbc055fce5d2e64b94 \ google-cloud-bigquery-0.26.0 -beta.jar       File2:C:\ Users \ Admin.gradle \ caches \ modules-2 \ files-2.1 \ com.google.cloud \ google-cloud-core \ 1.8.0 \ 98ede50a9dfdf818204cfc65e494936feb8c5078 \ google-cloud-core-1.8.0.jar

1 个答案:

答案 0 :(得分:1)

在您的应用级别gradle中。无论你得到什么重复把它放在这里。我进入了project.properties。我这样做了,它起作用了

android{
   ......
   ......
   ......

packagingOptions {
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/io.netty.versions.properties'
    exclude 'META-INF/INDEX.LIST'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'project.properties' <<<<<-------This line worked for me
}
}