在 gradle:3.0.0 上找到多个文件,其独立于操作系统

On gradle:3.0.0 More than one file was found with OS independent path #39;META-INF/ASL2.0#39;(在 gradle:3.0.0 上找到多个文件,其独立于操作系统的路径为“META-INF/ASL2.0)
本文介绍了在 gradle:3.0.0 上找到多个文件,其独立于操作系统的路径为“META-INF/ASL2.0"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将我的 Android 工作室更新到 3.0然后他要求升级到'com.android.tools.build:gradle:3.0.0'

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

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

<块引用>

发现多个文件具有独立于操作系统的路径META-INF/ASL2.0"

我的应用 gradle

 安卓{compileSdkVersion 26构建工具版本26.0.2"useLibrary 'org.apache.http.legacy'默认配置 {applicationId "com.test.demo"minSdkVersion 16targetSdkVersion 26版本代码 1版本名称1.0"testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"}构建类型 {发布 {缩小启用假proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'}}}'

我的图书馆毕业典礼

<代码>android {compileSdkVersion 26构建工具版本26.0.2"useLibrary 'org.apache.http.legacy'默认配置 {编译选项 {sourceCompatibility JavaVersion.VERSION_1_6目标兼容性 JavaVersion.VERSION_1_6}}构建类型 {发布 {缩小启用假proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'}}包装选项 {排除元信息/依赖项"排除元信息/许可证"排除 'META-INF/LICENSE.txt'排除 'META-INF/license.txt'排除元信息/通知"排除 'META-INF/NOTICE.txt'排除 'META-INF/notice.txt'排除 'META-INF/ASL2.0'}}

解决方案

你应该在应用程序 build.gradle 中添加你的 packagingOptions:

包装选项 {排除元信息/依赖项"排除元信息/许可证"排除 'META-INF/LICENSE.txt'排除 'META-INF/license.txt'排除元信息/通知"排除 'META-INF/NOTICE.txt'排除 'META-INF/notice.txt'排除 'META-INF/ASL2.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'.

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

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'
        }
    }
}'

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'
    }
}

解决方案

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"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)