本文介绍了在 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"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!