Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle Sync Failed in Android Studio 3.6 Cause invalid type code :85

I just update my Android Studio from version 3.5.3 to 3.6, now I open any project I see this error and gradle doesn't sync

enter image description here

like image 944
omid Avatar asked Feb 27 '20 14:02

omid


4 Answers

I was having the same issue. I solved it by changing the JDK version I was using which was JDK 13.

  1. Go to File -> Project Structure.
  2. On the left side, click on SDK Location and go to JDK Location.
  3. Change it to the Embedded JDK that comes with Android Studio.
  4. Click on OK.
like image 114
Glenn Sandoval Avatar answered Oct 30 '22 02:10

Glenn Sandoval


If you using Android Studio 4.0 or up and having Errors like below

    Cause: invalid type code: 17
    Cause: invalid type code: fe
    Cause: invalid type code: 13
 Cause: invalid type code: 85

Or

Its says that something wrong with JDK then Follow below steps to resolve the error.

Step 1: First delete .gradle and .idea folder from project directory and restart Android Studio. Make sure it's gone from recycle bin.

Step 2: Go to Project Structure

Project Structure

Step 3: Select SDK Location from the left panel on Project Structure window.

Step 4: Go to JDK Location and click on down arrow then select the jre instead of jdk

C:\Program Files\Android\Android Studio\jre

JDK Location

And it will Solve the errors. Rebuild the project

Note: jre come with the android studio 4 installation not sure about the older version.

This solution work for me.

like image 27
Arpit Patel Avatar answered Oct 30 '22 02:10

Arpit Patel


I found out that some people might use Android 4.0 with Java 14 and Gradle 6.1.1 like me. And they are not supported for each other, so just update Gradle to 6.5.1; it will solve the problem. To update Gradle, click in the Android Studio tab: File -> Project Structure -> Project. Then, change the Gradle version to 6.5.1.

all_java_gradle_verion

Thanks, it was very helpfull!

like image 22
Trần Hoàng Kim Long Avatar answered Oct 30 '22 04:10

Trần Hoàng Kim Long


Here's what I did to solve the issue with JDK 11 + Android 4.0.

  1. Follow Tran's answer (https://stackoverflow.com/a/62967378/5359328) and upgrade to Gradle 6.5.1.
  2. Build project. It still shows the same error.
  3. Change JDK to 8 in Project Structure, build. It's successful.
  4. Change JDK back to 11 in Project Structure, build. It's successful again.
like image 24
Siddharth Venu Avatar answered Oct 30 '22 02:10

Siddharth Venu