我在制作APK时遇到错误

时间:2018-03-05 21:54:30

标签: java android gradle compilation version

当我尝试构建我的APK时,我收到此错误。我目前正在和其他开发人员一起修复和修复此应用。在gradle中,他在每次编译中使用。+。我该如何解决?

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

  

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:android / support / design / widget / CoordinatorLayout.class

gradle:

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 个答案:

答案 0 :(得分:1)

  1. 删除所有" +"在你的图书馆依赖关系中 版本
  2. 在您的应用级关卡文件中尝试此操作

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

    如果它没有解决尝试记录依赖项运行此命令

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

    在你的android studio终端标签中,它会记录你项目的所有依赖树

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

    例如

    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'
    }