"在APK-META-INF / LICENSE.TXT&QUOT复制复制库文件;错误的Andorid工作室 [英] "Duplicate lib file copied in APK-META-INF/license.txt "error in andorid studio
问题描述
我使用低于2 LIB的项目
1.弹簧核心3.1.0.RELEASE.jar
2.弹簧网络3.1.0.RELEASE.jar
I am using below 2 lib's in project 1. spring-core-3.1.0.RELEASE.jar 2. spring-web-3.1.0.RELEASE.jar
而Android工作室正在考虑上述LIB的重复输入,并给予错误,而包装。
But android studio is considering duplicate entry for above lib's and giving error while packaging.
Error:duplicate files during packaging of APK E:\Code\iDoc\app\build\outputs\apk\app-debug-unaligned.apk
Path in archive: META-INF/license.txt
Origin 1: E:\Code\iDoc\app\libs\spring-core-3.1.0.RELEASE.jar
Origin 2: E:\Code\iDoc\app\libs\spring-web-3.1.0.RELEASE.jar
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'META-INF/license.txt'
}
}
------------------------------------------------------------
任何人都面临着类似的问题?
Anybody faced similar problem ?
请各地推荐一些工作,为这个错误。
Please suggest some-work around for this error.
推荐答案
转到的build.gradle
文件,并添加以下行:
Go to your build.gradle
file and add the following line:
packagingOptions {
exclude 'META-INF/license.txt'
}
在我来说,我不得不添加像这样的:
In my case I had to add like this one:
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.mcxiaoke.volley:library:1.0.15'
compile 'com.google.code.gson:gson:2.2.4'
compile "org.apache.httpcomponents:httpcore:4.4.1"
compile "org.apache.httpcomponents:httpmime:4.3.6"
}
注意:
-
的元文件不会影响应用程序的任何编程功能。元文件基本上包含像法律通知书文本信息,牌照开放的源库等。排除不会影响任何东西。的
的当我们使用多个第三方的开源库,有时2个或多个项目具有相同的命名文本文件(例如:的License.txt或Notice.txt或dependencies.txt)。这会导致在编译时间冲突。在那一刻,我们的强大的机器人工作室建议我们去排除那些冲突的元文件。的
这篇关于"在APK-META-INF / LICENSE.TXT&QUOT复制复制库文件;错误的Andorid工作室的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!