gpt4 book ai didi

java - 使用 appcompact 库在 android studio 中构建 Gradle 错误

转载 作者:太空宇宙 更新时间:2023-11-04 13:17:45 24 4
gpt4 key购买 nike

我收到此错误

Error:Execution failed for task ':yourapp:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/v7/recyclerview/BuildConfig.class

这是我的 build.gradle 文件

android {
compileSdkVersion 22
buildToolsVersion "23.0.1"

defaultConfig {
applicationId "com.test"
minSdkVersion 15
multiDexEnabled true
targetSdkVersion 22
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

dependencies {
compile (project(':library_slidingmenu')) {
exclude group: 'com.android.support', module: 'recyclerview-v7'
}
compile project(':library')
compile 'com.android.support:appcompat-v7:22.2.1'
androidTestCompile 'com.android.support:multidex-instrumentation:1.0.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0'
compile 'org.projectlombok:lombok:1.16.6'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.android.support:cardview-v7:22.1.0'
compile 'com.android.support:recyclerview-v7:22.1.0'

知道如何解决吗?

最佳答案

如果您的依赖项也声明了 recyclerview lib,则只需将其从依赖项中排除即可。例如,假设您的 lib library_slidingmenu 包含 recyclerview 依赖项,那么我们需要执行类似的操作

dependencies {
compile project(':library_slidingmenu') {
exclude group: 'com.android.support', module: 'recyclerview-v7'
}
// the rest of your dependecies
}

关于java - 使用 appcompact 库在 android studio 中构建 Gradle 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33392457/

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