我将源代码从Eclipse迁移到Android工作室,当我在android studio中构建项目时,我遇到了以下失败。
失败:构建因异常而失败。
错误:任务':app:transformClassesWithJarMergingForDebug'执行失败。 com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:android / support / v4 / print / PrintHelper $ 1.class
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile (project(':facebook')){
exclude group: 'com.android.support', module: 'multidex'
}
compile project(':libraryBasePera')
compile project(':google-play-services_lib')
compile 'com.android.support:multidex:1.0.1'
}
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
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')
}
}
我尝试了很多方法(排除模块支持-v4,删除了support-v4 jar,清理,重建项目...)但我仍然被困在这里。任何人都可以帮我解决问题吗?
非常感谢。
答案 0 :(得分:0)
尝试检查lib文件夹。我有同样的错误,因为我错误地在我的lib文件夹中添加了 support-v4 jar 。