多支持-V4罐子导致问题 [英] Multiple support-v4 jars causing issues
问题描述
我已经从出口的Eclipse项目 - 但现在我可以支持库不能添加到我的项目编译com.android.support:support-v4:21.0.0'$c$ C> beause了在这个项目中使用的库有自己的同一个库的副本(但他们有它在其
库
文件夹中的jar文件)。现在,当我加入编译com.android.support:support-v4:21.0.0
我得到这个问题:
错误:执行失败的任务:ATHAN:packageAllDebugClassesForMultiDex。
> java.util.zip.ZipException:重复的条目:安卓/支持/注释/ IntDef.class
有人可以帮助我解决这个问题?
这是我的应用程序的build.gradle
应用插件:'机器人'
依赖{
编译文件树(导演:'库',包括:的* .jar)
编制项目(:谷歌播放services_lib')
编制项目(':library_viewpager')
编制项目(':sliding_library')
编制项目(':Android的支持-V7-应用程序兼容性)
编译com.android.support:multidex:1.0.0
编译com.android.support:support-v4:21.0.0
}安卓{
compileSdkVersion 21
buildToolsVersion22.0.1 dexOptions {
preDexLibraries = FALSE
} defaultConfig {
multiDexEnabled真
} sourceSets {
主要{
manifest.srcFile'的AndroidManifest.xml
java.srcDirs = ['src'中]
resources.srcDirs = ['src'中]
aidl.srcDirs = ['src'中]
renderscript.srcDirs = ['src'中]
res.srcDirs = ['水库']
assets.srcDirs = ['资产']
} //移动测试,测试/ JAVA,测试/ RES等...
instrumentTest.setRoot(测试) //移动构建类型构建类型/<&型GT;
//例如,建立类型/调试/ JAVA,内置类型/调试/ AndroidManifest.xml中,...
//这个动作出来在src / LT他们默认位置和的;类型> / ...这将
//与SRC /冲突正在使用的主要来源集。
//添加新的构建类型或产品的口味应该陪同
//通过类似定制。
debug.setRoot(集结类型/调试)
release.setRoot(集结类型/释放)
}
}
只有在库项目添加支持罐子。没有必要将其添加到主项目,并记住所有支持库应该是同一版本的
I've exported a project from eclipse - but now I cannot add the support library to my project compile 'com.android.support:support-v4:21.0.0'
beause the libraries that are used in this project have their own copy of the same library(but they have it in a jar file in their libs
folder). Now when I added compile 'com.android.support:support-v4:21.0.0'
I get this issue:
Error:Execution failed for task ':Athan:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/annotation/IntDef.class
Can someone help me to resolve this issue?
This is my app build.gradle
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':google-play-services_lib')
compile project(':library_viewpager')
compile project(':sliding_library')
compile project(':android-support-v7-appcompat')
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:support-v4:21.0.0'
}
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
dexOptions {
preDexLibraries = false
}
defaultConfig {
multiDexEnabled true
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
Add support jar only in library projects. No need to add it in main project and keep in mind all support library should be of same version
这篇关于多支持-V4罐子导致问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!