16

I am using android studio 2.3.1 and it was working fine yesterday But now it throw me an error Error:Cause: invalid stream header: 000900D9 this message throw from Messages Gradle Sync dialog.

Below are the steps which i did to fixed this problem but nothing works for me

1.invalidate cache and restart

  1. Delete scripts and scripts-remapped files from C:\Users\suraj.gradle\caches\3.3

and also checked many post in stackoverflow but nothing work for me and most of the questions put here are not answered by anyone yet .

Under my project structure

Compile Sdk version :Api 25

Build tool version :25.0.2

Suraj Bahadur
  • 3,730
  • 3
  • 27
  • 55
  • I did that and also mention in the post but it doesn't work for me . – Suraj Bahadur Apr 18 '17 at 05:50
  • Anyone have solution of this problem ? please let me know the technical reason why you down vote it and i post this question because i was not getting anything in stack overflow related this issue. – Suraj Bahadur Apr 18 '17 at 13:09

8 Answers8

15

I was facing the same problem and was not able to figure out what exactly causes this problem.

But removing the whole .gradle folder (/home/$USER/.gradle in my case) and rebuilding the app fixed it.

Michael
  • 276
  • 2
  • 10
  • Thank you for another trick to fixed this issue.I will try it if having same problem in future. – Suraj Bahadur Apr 19 '17 at 12:43
  • 1
    I had this issue when my system froze and I had to hard reset. Remove .gradle, rebuild, and be happy :) – sulai Apr 20 '17 at 10:45
  • 1
    I kept removing the `.gradle` in my project directory but it did not help. I had to remove the `.gradle` in `/home/$USER` and it worked. Also, running `./gradlew --stacktrace` helped trace the problem to `/home/$USER/.gradle` with the message `FAILURE: Build failed with an exception... * What went wrong: Could not read cache value from '/home/$USER/.gradle/daemon/4.1/registry.bin'.` – hexicle Dec 23 '17 at 05:13
  • hello i just create new project and i got this error Cause: invalid stream header: FD14090D and there is no .gradle folder what can i do? – Makvin Sep 29 '18 at 04:12
  • That's won't help in most cases, it's not the root of the problem – tomrozb Feb 07 '19 at 11:36
5

I noticed that many users (me included) faced this issue using the 3.3 gradle version; update to 3.5 and it will be fine

Andrea
  • 51
  • 4
5

Go to your console, run

./gradlew --stacktrace

If it says

GradleException: Could not read cache value from '[...]/.gradle/daemon/3.3/registry.bin'

go to this folder and delete the file registry.bin.lock. No need to delete the whole .gradle directory and download everything again.

sulai
  • 5,204
  • 2
  • 29
  • 44
2

Andrea's answer worked for me, too (i.e. upgrading gradle from 3.3 to 3.5). For the shake of completeness, I'd just like to add that you can update gradle in your Android Studio by going to:

File > Project Structure > Project

You might have to update your Android Plugin Version, too. Check the version compatibility table for more information.

Georgios
  • 4,764
  • 35
  • 48
1

File > Invalidate Caches / Restart

efeyc
  • 2,122
  • 2
  • 27
  • 39
1

Error: Gradle sync failed: Cause: invalid stream header: 005C0044, 000900D9, ... or other some of the Gradle sync failed

There is a good method for this issue. you should update the android gradle as following in three steps:

1) Download latest gradle version form link: https://gradle.org/releases/

2) Unzip the download file and copy it in address: C:\Program Files\Android\Android Studio\gradle

3) In the android studio, change gradle version to the latest gradle version (4.5.1 based on the unzip file, which had been named as the gradle-4.5.1) in path: File>Project structure>Project>gradle version

4) In the android studio, change the gradle home file (File>Settings>Build,Execution,Development>gradle>gradle home) to address: C:\Program Files\Android\Android Studio\gradle\gradle-4.5.1.

R. Yaghoobi
  • 459
  • 4
  • 5
0

It's gradle version.

I've updated gradle from 4.6 to 4.10.1 on one branch. Switched to another branch without gradle update and couldn't sync it. Updating gradle to the latest version on all branches helped solved the problem.

So check which gradle version you have in gradle/wrapper/gradle-wrapper.properties file and try to update it to match your .gradle directory (or just update to the latest one)

E.g.

  • there is a .gradle/4.10.1 directory
  • gradle/wrapper/gradle-wrapper.properties is pointing to the same gradle version

    distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
    
tomrozb
  • 25,773
  • 31
  • 101
  • 122
0

This Works

Delete

caches in .gradle 
caches in folder where your android studio project is located
delete all iml files
delete .gradle in folder where your project is located

happy coding

Nehemiah Narzary
  • 336
  • 4
  • 11