gpt4 book ai didi

java - 我在构建 APK 时遇到错误

转载 作者:行者123 更新时间:2023-12-02 11:33:20 27 4
gpt4 key购买 nike

当我尝试构建我的 APK 时遇到此错误。我目前正在维护和修复另一个开发人员提供的这个应用程序。在 gradle 中,他在每次编译中都使用了 .+。我该如何修复它?

错误:错误:任务“:app:transformClassesWithJarMergingForDebug”执行失败。

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/design/widget/CoordinatorLayout.class

梯度:

buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'

repositories {
maven { url 'https://maven.fabric.io/public' }
}

android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.easyfixapp.easyfix"
minSdkVersion 15
targetSdkVersion 26
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
configurations.all {
resolutionStrategy {
force 'com.google.code.findbugs:jsr305:3.0.1'
}
}
}

realm {
syncEnabled = true;
}
repositories {
mavenCentral()
}
dependencies {
compile('com.facebook.android:facebook-android-sdk:[4,5)') {
exclude group: 'com.android.support', module: 'multidex'
}
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:support-v4:26.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support:support-vector-drawable:26.+'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.android.support:recyclerview-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:mediarouter-v7:26.+'
compile 'com.google.android.gms:play-services:11.6.0'
compile 'com.google.firebase:firebase-messaging:11.6.0'
compile 'com.prolificinteractive:material-calendarview:1.4.3'
compile 'com.hbb20:ccp:2.0.5'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'uk.co.chrisjenx:calligraphy:2.3.0'
compile 'com.github.bumptech.glide:glide:4.2.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.github.chrisbanes:PhotoView:2.0.0'
compile('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
transitive = true;
}
annotationProcessor 'com.github.bumptech.glide:compiler:4.2.0'
testCompile 'junit:junit:4.12'
}

apply plugin: 'com.google.gms.google-services'

最佳答案

  1. 删除库依赖项中的所有“+”版本
  2. 在您的应用级 gradle 文件中尝试此操作

    implementation('com.github.bumptech.glide:glide:4.6.1') {
    exclude group: 'com.android.support'
    }`

    如果不能解决,请尝试记录依赖项,运行此命令

    ./gradlew -q dependencies app:dependencies --configuration compile

    在你的 android studio 的终端选项卡中,它将记录项目的所有依赖关系树

然后找到哪些库正在使用重复的依赖项

例如

implementation 'com.github.bumptech.glide:glide:4.6.1' 

正在使用重复的依赖项,因此请更改

 implementation 'com.github.bumptech.glide:glide:4.6.1'

implementation('com.github.bumptech.glide:glide:4.6.1') {
exclude group: 'com.android.support'
}

关于java - 我在构建 APK 时遇到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49120122/

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