本文介绍了在 gradle:3.0.0 上找到了多个文件,其操作系统独立路径为“META-INF/ASL2.0"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已将我的 Android Studio 更新到 3.0然后他要求升级到 'com.android.tools.build:gradle:3.0.0'
一切都很顺利,直到我决定运行我的项目并且它给了我这个错误
错误:任务:app:transformResourcesWithMergeJavaResForDebug"的执行失败.
发现多个文件的操作系统独立路径为META-INF/ASL2.0"
我的应用程序
android {compileSdkVersion 26构建工具版本26.0.2"useLibrary 'org.apache.http.legacy'默认配置{applicationId "com.test.demo"minSdk 版本 16目标SDK版本26版本代码 1版本名称1.0"testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"}构建类型{释放 {minifyEnabled falseproguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'}}}'
我的图书馆毕业
android {compileSdkVersion 26构建工具版本26.0.2"useLibrary 'org.apache.http.legacy'默认配置{编译选项{sourceCompatibility JavaVersion.VERSION_1_6targetCompatibility JavaVersion.VERSION_1_6}}构建类型{释放 {minifyEnabled falseproguardFiles 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'}}
解决方案
您应该将您的 packagingOptions
添加到应用程序 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.0and 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'.
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"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!