Android Gradle 3.0.0-ZLIB输入流意外结束

Alb*_*n.E 3 android gradle android-studio android-gradle-plugin android-gradle-3.0

将android studio更新到3.0并切换到后,gradle plugin 3.0.0我收到此错误:

Gradle '...' project refresh failed
    Error:Unexpected end of ZLIB input stream
Run Code Online (Sandbox Code Playgroud)

问题既出现在我所有的旧项目中,也出现在全新的项目中。关于什么原因的任何想法?Gradle 2.3.3正常工作

我的项目build.gradle

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.1.51'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
Run Code Online (Sandbox Code Playgroud)

任何帮助,将不胜感激!

小智 5

我的工作室从2.3.3升级到3.0后,我遇到了同样的问题,当然我的项目gradle插件版本也从2.3.3升级到了3.0。

我认为gradle插件jar文件已损坏且不可读或发生了任何未知的异常,因此请将其删除并重新下载。

我建议的是

  • 删除Studio安装路径中的gradle文件夹(我的文件夹为D:\ Tool \ android-studio \ gradle),
  • 重新同步您的项目。该项目将重新下载其依赖项。

如果问题没有解决,请尝试删除gradle用户数据(我的是C:\ Users \ tea \ .gradle),然后重新同步项目。