问题
After updating android studio to 3.0 and switching to gradle plugin 3.0.0
I am getting this error:
Gradle '...' project refresh failed
Error:Unexpected end of ZLIB input stream
The problems appears both in all my old projects but brand new ones as well. Any Idea on what is causing this? Gradle 2.3.3 works fine
my project 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
}
And the 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
Any help would be appreciated!
回答1:
I had the same problem after my studio upgraded from 2.3.3 to 3.0, of course I have upgraded my project gradle plugin version from 2.3.3 to 3.0.
I think the gradle plugin jar file is broken and not readable or any unknow exception happened, so delete it and re-download.
What I propose is to,
- Delete gradle folder in studio installed path (mine is D:\Tool\android-studio\gradle),
- Re-sync your project. The project will re-download its dependencies.
If the problem is not solved, try to delete your gradle user data (mine is C:\Users\tea\.gradle) and then re-sync project.
回答2:
It's solved in MAC
- uninstall
gradle
brew uninstallgradle
brew install gradle
cd ~/[users].gradle/
rm -r *
- synchronize android studio
回答3:
Pls. see this official tutorial on gradle migration to 3.0.
Had similar issue - the reason was that in manifest was written meta_data
instead of meta-data
. For older gradle it was just warning, for new - fatal error.
Maybe you have something similar.
来源:https://stackoverflow.com/questions/47111364/android-gradle-3-0-0-unexpected-end-of-zlib-input-stream