Failed to open zip file.

作者: 二愣子传奇 | 来源:发表于2018-12-11 15:42 被阅读2次

    android studio更新到3.2以后,原先版本的gradle工具(2.1)已无法正常使用,更新后(4.6版本),问题解决。

    Failed to open zip file.

    Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

    Re-download dependencies and sync project (requires network)

    Re-download dependencies and sync project (requires network)

    参考了几篇网络上的文章后,有了一些经验,希望能帮到大家,

    接下来以Failed to open zip file.这个错误为基础,记录解决过程:

    1、3.2版本以后的AS,默认安装的gradle插件是3.0.0+,其对应的gradle版本是4.1+。只有版本对应上了,才能继续往下走,否则第一个坑都跳不出去。具体更新方式请移步

    2、版本对应后又会报以下异常,这是因为google,jcenter插件需要移步国内镜像才行

    Could not find com.android.tools.build:gradle:3.2.0. Searched in the following locations: https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.0/gradle-3.2.0.pom https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.0/gradle-3.2.0.jar Required by: project : Add Google Maven repository and sync project Open File Enable embedded Maven repository and sync project

    jcenter插件需要移步国内镜像

    具体修改分为两步:

    1、project下的build.gradle中,添加

    allprojects {

    repositories {

    jcenter()

    maven { url'https://maven.aliyun.com/repository/jcenter' }

    }

    }

    project下的build.gradle中,添加

    2、app下的build.gradle中,buildTypes目录下添加

    repositories {

    maven {

    url"http://maven.google.com"

        }

    maven { url'https://maven.aliyun.com/repository/google' }

    maven { url'https://maven.aliyun.com/repository/jcenter' }

    maven { url'http://maven.aliyun.com/nexus/content/groups/public' }

    }

    app下的build.gradle中,buildTypes目录下添加

    相关文章

      网友评论

        本文标题:Failed to open zip file.

        本文链接:https://www.haomeiwen.com/subject/mozshqtx.html