我的摇篮是:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        applicationId "com.belajarku.gamelari"
        minSdkVersion 14
        targetSdkVersion 25
        multiDexEnabled true


    }

    dexOptions {
        // Prevent OutOfMemory with MultiDex during the build phase
        javaMaxHeapSize "4g"
    }

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


    }
    sourceSets.main {
        jni.srcDirs = []// <-- disable automatic ndk-build call
    }
}

dependencies {
    compile ('com.google.android.gms:play-services:+'){exclude module: 'support-v4'}
    compile files('libs/dagger-1.2.2.jar')
    compile files('libs/javax.inject-1.jar')
    compile files('libs/nineoldandroids-2.4.0.jar')
    compile files('libs/support-v4-19.0.1.jar')
    compile ('com.android.support:multidex:1.0.1'){exclude module: 'support-v4'}
}


但是当我构建apk项目时,请说:


  错误:任务执行失败
  ':app:transformClassesWithJarMergingForDebug'。
  
  
    com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复项:
    android / support / v4 / database / DatabaseUtilsCompat.class
  


请帮我修复它。

最佳答案

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:android / support / v4 / database / DatabaseUtilsCompat.class


您要为同一类添加不同版本的两倍。

compile ('com.google.android.gms:play-services:+'){exclude module: 'support-v4'}
compile files('libs/support-v4-19.0.1.jar')


使用com.google.android.gms:play-services:+,您将添加所有与support-v4相关的播放服务库软件包。

07-24 09:49
查看更多