我试图在立即关闭运行时运行我的应用程序,但是我得到了以下错误:
错误:任务':app:transformClassesWithJarMergingForDebug'.执行失败 com.android.build.api.transform.TransformException: java.util.zip.ZipException:重复条目: android/support/v4/view/KeyEventCompatEclair.class
这是我的分级文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.jua.app"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile project(path: ':app_Data')
compile files('libs/android-support-v4.jar')
}我尝试了this线程的解决方案:
compile files('libs/android-support-v4.jar'){
exclude module: "support-v4"
}现在,当我尝试同步现在的gradle.build时,我收到了这个错误:
错误:(29,0)在org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection.类型的文件集合上找不到参数{模块=Support-v4}的方法exclude()打开文件
我现在有点迷茫,如果有人知道如何解决这个问题,我会很感激的。
编辑
我把
编译文件(‘libs/android-support-v4.jar’)
完全地,我仍然会犯第一个错误。
发布于 2017-05-22 11:40:40
这是一个语法问题。调用exclude的闭包被解释为file()方法的参数,这是不正确的。应该是这样的
compile (files('libs/android-support-v4.jar')){
exclude module: "support-v4"
}发布于 2017-01-21 10:57:09
对于任何有同样问题的人,我从文件夹中删除了android-support-v4.jar,现在它开始工作了。由于某些原因,如果从gradle.build文件中删除它,它将继续造成问题。
https://stackoverflow.com/questions/41770540
复制相似问题