多个 support-v4 jar 导致问题
Multiple support-v4 jars causing issues
我已经从 eclipse 中导出了一个项目 - 但现在我无法将支持库添加到我的项目中 compile 'com.android.support:support-v4:21.0.0'
因为这个项目中使用的库有它们自己的同一个库的副本(但是它们将其放在 libs
文件夹中的 jar 文件中)。现在,当我添加 compile 'com.android.support:support-v4:21.0.0'
时,我遇到了这个问题:
Error:Execution failed for task ':Athan:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/annotation/IntDef.class
有人可以帮我解决这个问题吗?
这是我的应用程序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')
}
}
仅在库项目中添加支持 jar。无需在主项目中添加它,并记住所有支持库应该是相同版本
我已经从 eclipse 中导出了一个项目 - 但现在我无法将支持库添加到我的项目中 compile 'com.android.support:support-v4:21.0.0'
因为这个项目中使用的库有它们自己的同一个库的副本(但是它们将其放在 libs
文件夹中的 jar 文件中)。现在,当我添加 compile 'com.android.support:support-v4:21.0.0'
时,我遇到了这个问题:
Error:Execution failed for task ':Athan:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/annotation/IntDef.class
有人可以帮我解决这个问题吗?
这是我的应用程序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')
}
}
仅在库项目中添加支持 jar。无需在主项目中添加它,并记住所有支持库应该是相同版本