Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 渐变生成错误,错误:任务';的执行失败:应用程序:transformResourcesWithMergeJavaResForDebug';在pom.xml中_Android_Android Gradle Plugin - Fatal编程技术网

Android 渐变生成错误,错误:任务';的执行失败:应用程序:transformResourcesWithMergeJavaResForDebug';在pom.xml中

Android 渐变生成错误,错误:任务';的执行失败:应用程序:transformResourcesWithMergeJavaResForDebug';在pom.xml中,android,android-gradle-plugin,Android,Android Gradle Plugin,大家好,我在尝试运行android应用程序时遇到以下错误: 渐变生成错误,错误:任务执行失败“:app:transformResourcesWithMergeJavaResForDebug” com.android.build.api.transform.TransformException:com.android.builder.packaging.DuplicateFileException:APK META/INF/maven/com.squareup.okio/okio/pom.xml中

大家好,我在尝试运行android应用程序时遇到以下错误:

渐变生成错误,错误:任务执行失败“:app:transformResourcesWithMergeJavaResForDebug” com.android.build.api.transform.TransformException:com.android.builder.packaging.DuplicateFileException:APK META/INF/maven/com.squareup.okio/okio/pom.xml中复制的重复文件

这是我的两个gradle文件:

  // Top-level build file where you can add configuration options common to 
  all sub-projects/modules.

buildscript {
repositories {
    jcenter()

}
dependencies {
    classpath 'com.android.tools.build:gradle:2.1.0'
    classpath 'com.google.gms:google-services:3.1.0'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
 repositories {
    jcenter()
    apply plugin: 'maven'
    maven { url 'https://maven.google.com' }
    maven {url 'https://maven.fabric.io/public'}
 }
 }

task clean(type: Delete) {
   delete rootProject.buildDir
}
这是另一个:

请帮忙

android {  
......
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'
}
}

添加此项以排除META-inf文件

添加此
打包选项{exclude'META-inf/DEPENDENCIES'exclude'META-inf/NOTICE'exclude'META-inf/LICENSE'}
。希望这对你有帮助。谢谢兄弟。如果你愿意,你可以把这个作为答案,如果你愿意,我可以接受它作为正确的解决方案。问候语!谢谢,但这并没有解决问题。
android {  
......
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'
}
}