错误:任务“:app:transformDexWithInstantRunSlicesApkForDebug"的执行失败.无法读取 zip 文件 [英] Error:Execution failed for task ':app:transformDexWithInstantRunSlicesApkForDebug'. Failed to read zip file

查看:28
本文介绍了错误:任务“:app:transformDexWithInstantRunSlicesApkForDebug"的执行失败.无法读取 zip 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试构建我的项目时出现以下错误.我使用的是 Android Studio 2.3.3 和 macOS High Sierra.

I get the following error when I tried to build my project. I'm using Android Studio 2.3.3 and macOS High Sierra.

Error:Execution failed for task ':app:transformDexWithInstantRunSlicesApkForDebug'.
> java.io.UncheckedIOException: java.io.IOException: Failed to read zip file '/Users/tanyalertwichaiworawit/AndroidStudioProjects/BensBoat/app/build/intermediates/split-apk/debug/slices/slice_1.apk'.

Gradle 文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "xx.xx.xx"
        minSdkVersion 17
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    // Simple Auth
    android.defaultConfig.manifestPlaceholders = [
            facebookAppId        : "123123123",
            googleWebClientId    : "",
            twitterConsumerKey   : "dcLF7SQehnNFvJ",
            twitterConsumerSecret: "9cUW1PEjGmqh3f93Ly5MwY",
            instagramClientId    : "",
            instagramClientSecret: "",
            instagramRedirectUri : ""
    ]

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/fonts'] } }
}

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:26.0.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'

    // Picasso
    compile 'com.squareup.picasso:picasso:2.5.2'

    // GSON with Retrofit
    compile 'com.google.code.gson:gson:2.8.0'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.squareup.okhttp3:okhttp:3.9.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.9.0'

    // KProgressHUD
    compile 'com.kaopiz:kprogresshud:1.1.0'

    // Circle indicator
    compile 'me.relex:circleindicator:1.2.2@aar'

    // Buttons
    compile 'info.hoang8f:fbutton:1.0.5'

    // Stateful Layout
    compile 'com.github.gturedi:stateful-layout:1.2.1'

    // Model name
    compile 'com.jaredrummler:android-device-names:1.1.5'

    // SimpleAuth
    //compile 'com.jaychang:simpleauth:2.1.3'
    compile 'com.jaychang:simpleauth-facebook:2.1.3'
    compile 'com.jaychang:simpleauth-twitter:2.1.3'

    // Easy Prefs
    compile 'com.pixplicity.easyprefs:library:1.9.0'

    // TSnackbar
    compile 'com.androidadvance:topsnackbar:1.1.1'
}

项目级gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()

        maven { url "https://maven.google.com"}
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

推荐答案

在偏好设置中关闭 Instant Run 对我有帮助

Switch off the Instant Run in Preferences helped me

这篇关于错误:任务“:app:transformDexWithInstantRunSlicesApkForDebug"的执行失败.无法读取 zip 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆