Android - Gradle - app:transformResourcesWithMergeJavaResForDebug java.util.zip.ZipException

时间:2017-03-15 16:17:54

标签: java android gradle android-gradle

在构建我的项目时,我得到了:

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> java.util.zip.ZipException: error in opening zip file

已经尝试使gradle缓存无效,删除它们(文件夹.android \ build-cache)并寻找类似的问题。

我使用最新的android插件和gradle版本(2.3.0和3.3)。

尝试使用以前的版本(2.2.3和2.14.1),我收到类似的错误。

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: Exception while checking library jar

Gradle文件如下:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "XXXXXXXXXXXXXXXX"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    android.defaultConfig.vectorDrawables.useSupportLibrary = true;
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:support-v4:25.2.0'
    compile 'com.android.support:design:25.2.0'
    compile 'com.google.maps.android:android-maps-utils:0.4.3'
    compile 'com.google.android.gms:play-services-maps:10.2.0'
    compile 'com.google.android.gms:play-services-location:10.2.0'
    testCompile 'junit:junit:4.12'

    //3rd Party
    compile 'com.getbase:floatingactionbutton:1.10.1'
    compile 'com.jakewharton:butterknife:8.5.1'
    compile 'org.greenrobot:eventbus:3.0.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
    compile 'org.parceler:parceler-api:1.1.6'
    annotationProcessor 'org.parceler:parceler:1.1.6'
}

1 个答案:

答案 0 :(得分:0)

删除app / build目录中的文件可能有所帮助。 (它包含许多中间文件,将在下一次构建期间再次生成)