gpt4 book ai didi

android - Gradle : Execution Failed For Task

转载 作者:行者123 更新时间:2023-11-29 15:53:23 24 4
gpt4 key购买 nike

您好,我刚刚尝试编写一个带有滑动的 Android 选项卡布局示例程序。我在 lib 文件夹中添加了 android 支持库。我在其中添加了 appcompat v4 和 v7。之后,我单击了带有 gradle 文件的同步项目。然后我输入代码,然后一切顺利,我发现代码中没有错误,但是当我尝试运行该程序时,它显示了这个错误

Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/annotation/ArrayRes.class

我的 build.gradle 文件包含这个

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "com.example.eugene.swipeabletablayout"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
}

在我的代码中没有问题,但我不知道为什么会出现此错误。

我试图在 SOF 中搜索这个问题,但没有找到任何答案。

最佳答案

从 libs 目录中删除 Android 支持库。由于您使用的是 gradle 并已指示与 appcompat-v7 的编译依赖关系,因此您无需手动包含 JAR。这导致在构建时与重复符号发生冲突。将其列为编译依赖项将导致 gradle 与 Maven 一起自动提取库(及其依赖项)。

关于android - Gradle : Execution Failed For Task,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29276853/

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