构建项目时的TransformException

时间:2017-02-12 16:19:22

标签: android android-studio

以下是我的build.gradle文件

buildscript {
    repositories {
        mavenCentral()
        maven { url "https://jitpack.io" }
    }

    dependencies {
        classpath 'me.tatarka:gradle-retrolambda:3.3.0'
    }
}


repositories {
    mavenCentral()
    maven { url "https://jitpack.io" }
}

apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"
    defaultConfig {
        applicationId "com.abc.def"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        generatedDensities = []
        multiDexEnabled true
    }
    dexOptions {
        javaMaxHeapSize "4g"
        incremental true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
}
def final APP_COMPAT_VERSION = "24.0.+"

dependencies {

    compile "com.android.support:design:$APP_COMPAT_VERSION"
    compile 'com.android.support:cardview-v7:23.3.+'
    compile 'com.android.support:support-vector-drawable:23.3.+'
    compile 'com.android.support:cardview-v7:25.1.0'
    compile 'com.android.support:palette-v7:25.1.0'

    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.facebook.rebound:rebound:0.3.8'

}

运行此项目时出现以下错误

  

错误:任务执行失败   ':应用程序:transformClassesWithJarMergingForDebug'

     
    

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:     安卓/支持/ V4 /文本/ BidiFormatter $ 1.class

  

我在清理项目后尝试构建。我试图删除构建文件夹并重新重新生成项目,但我仍然收到此错误。我怎样才能解决这个问题?

1 个答案:

答案 0 :(得分:1)

使用相同版本的支持库。

compile "com.android.support:design:$APP_COMPAT_VERSION"
compile "com.android.support:cardview-v7:$APP_COMPAT_VERSION"
compile "com.android.support:support-vector-drawable:$APP_COMPAT_VERSION"
compile "com.android.support:cardview-v7:$APP_COMPAT_VERSION"
compile "com.android.support:palette-v7:$APP_COMPAT_VERSION"