在gradle上:3.0.0发现多个文件与操作系统无关的路径'META-INF / ASL2.0' [英] On gradle:3.0.0 More than one file was found with OS independent path 'META-INF/ASL2.0'

查看:1840
本文介绍了在gradle上:3.0.0发现多个文件与操作系统无关的路径'META-INF / ASL2.0'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将Android Studio升级到3.0
,然后他要求升级到'com.android.tools.build:gradle:3.0.0'

I have updated my Android studio to 3.0 and then he asked to upgrade to 'com.android.tools.build:gradle:3.0.0'

一切都很顺利,直到我决定运行我的项目,它给了我这个错误

everything went well until i decided to run my project and it's giving me this Error

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.




发现多个文件与操作系统无关的路径'META-INF /ASL2.0'

More than one file was found with OS independent path 'META-INF/ASL2.0'

我的应用程序gradle

My app gradle

   android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "com.test.demo"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}'

我的图书馆gradle

My Library gradle

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_6
            targetCompatibility JavaVersion.VERSION_1_6
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
    }
}


推荐答案

您应该添加到应用程序 build.gradle 您的 packagingOptions

You should add to application build.gradle your packagingOptions:

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/ASL2.0'
}

这篇关于在gradle上:3.0.0发现多个文件与操作系统无关的路径'META-INF / ASL2.0'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆