Android Gradle插件3.0.0-beta2 - ZLIB输入流的意外结束

时间:2017-09-01 21:57:23

标签: android android-studio gradle android-gradle

我今天尝试使用新版gradle plugin - 3.0.0-beta2的Android Studio 3.0 Beta 2。我向存储库添加了google()点击了同步,但是有一个奇怪的错误:

Gradle 'X' project refresh failed
    Error:Unexpected end of ZLIB input stream

什么可能导致此错误?即使我创建一个新的空项目,它也会出现。在Gradle插件2.3.3上,一切都很棒。

我的项目build.gradle

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

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-beta3'
        classpath 'me.tatarka:gradle-retrolambda:3.7.0'
        classpath 'com.google.gms:google-services:3.1.0'

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

allprojects {
    repositories {
        google()
        maven { url "http://dl.bintray.com/populov/maven" }
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

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-rc-1-all.zip

提前致谢;)

1 个答案:

答案 0 :(得分:0)

尝试在build.gradle项目文件的构建脚本中添加它:

buildscript {
repositories {
    jcenter()
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
}
dependencies {
    //This should be beta 2 in this case
    classpath 'com.android.tools.build:gradle:3.0.0-beta4' 
}

}

你也应该这样:

    allprojects {
    repositories {
        jcenter()
        maven { url "https://maven.google.com" }
    }
}

把它放在一起你应该有这样的东西:

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-beta4'

        // 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
}

然后转到选项菜单>>>构建>>>清理项目,然后重建项目。

如果那不起作用,那么: 1.开放终端:./gradlew clean 2.退出并重新启动android studio。