gpt4 book ai didi

java - 找不到参数 [{module=support-v4}] 的方法 exclude()

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:51:55 24 4
gpt4 key购买 nike

我试图在关闭即时运行的情况下运行我的应用程序,但出现此错误:

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/view/KeyEventCompatEclair.class

这是我的 gradle 文件:

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 时收到此错误:

Error:(29, 0) Could not find method exclude() for arguments [{module=support-v4}] on file collection of type org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection. Open File

我现在有点迷茫,如果有人知道如何解决这个问题,我将不胜感激。

编辑

我删除了

compile files('libs/android-support-v4.jar')

完全正确,我仍然得到第一个错误。

最佳答案

这是语法问题。您调用 exclude 的闭包被解释为 files() 方法的参数,这是不正确的。应该是这样的

compile (files('libs/android-support-v4.jar')){
exclude module: "support-v4"
}

关于java - 找不到参数 [{module=support-v4}] 的方法 exclude(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41770540/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com