gpt4 book ai didi

android - Android:build.gradle中的重复条目

转载 作者:行者123 更新时间:2023-12-03 04:36:39 24 4
gpt4 key购买 nike

我试图用Android Studio运行我的Android应用程序,但显示以下消息时显示错误。

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.transform.api.TransformException: java.util.zip.ZipException: duplicate entry: com/mikepenz/iconics/core/BuildConfig.class

似乎有一个重复的库,所以这就是它停止运行的原因。但老实说,我不知道应该使用build.gradle文件修复哪个问题。所以我把build.gradle文件放在这里,有人请帮帮我。
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

//wrap with try and catch so the build is working even if the signing stuff is missing
try {
apply from: '../../../signing.gradle'
} catch (ex) {
}

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
applicationId "com.marshall.opensurvey"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true

applicationVariants.all { variant ->
variant.outputs.each { output ->
def file = output.outputFile
def fileName = file.name.replace(".apk", "-v" + versionName + "-c" + versionCode + ".apk")
output.outputFile = new File(file.parentFile, fileName)
}
}
}
buildTypes {
debug {
applicationIdSuffix ".debug"
versionNameSuffix "-DEBUG"
try {
signingConfig signingConfigs.debug
} catch (ex) {
}
minifyEnabled false
}
release {
try {
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} catch (ex) {
}
zipAlignEnabled true
minifyEnabled false
}
}
lintOptions {
abortOnError false
}
}

repositories() {
mavenCentral()
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:support-v13:23.1.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.squareup.picasso:picasso:2.3.2'

// Google Analytics Library
compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile 'com.google.android.gms:play-services:8.1.0'

// Glide Library
compile 'com.github.bumptech.glide:glide:3.6.1'

// Material Drawer Library by Mike Penz
compile('com.mikepenz:materialdrawer:4.3.8@aar') {
transitive = true
}

// Android Iconics Library by Mike Penz
compile 'com.mikepenz:iconics-core:1.7.9@aar'
compile 'com.mikepenz:google-material-typeface:1.2.0.1@aar'

// Circle image view library
compile 'de.hdodenhof:circleimageview:2.0.0'

// AboutLibraries by Mike Penz
compile('com.mikepenz:aboutlibraries:5.2.5@aar') {
transitive = true
}
}

最佳答案

您的依赖项存在冲突。
duplicate entry: com/mikepenz/iconics/core/BuildConfig.class
这意味着您的两个依赖项包含此类

// Android Iconics Library by Mike Penz
compile 'com.mikepenz:iconics-core:1.7.9@aar'
compile 'com.mikepenz:google-material-typeface:1.2.0.1@aar'

// AboutLibraries by Mike Penz
compile('com.mikepenz:aboutlibraries:5.2.5@aar') {
transitive = true // <- Why?
}

我的猜测是不应该指定 transitivecom.mikepenz库之一实际上包含其他库之一。例如,如果 iconics-core中包含 aboutlibraries,则应通过以下方式将其排除
compile('com.mikepenz:aboutlibraries:5.2.5@aar') {
exclude module: 'com.mikepenz', name: 'iconics-core'
}

通过 dependencies运行gradle任务 gradle dependencies,可以轻松找到依赖关系问题。这显示了一个不错的库图表,该库依赖于其他库

关于android - Android:build.gradle中的重复条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33245896/

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