No cached version of gradle

送分小仙女□ 提交于 2019-11-28 01:05:41

In my case I also had an additional "offline switch" to the one in Gradle.

Go to:

File > Settings > Build, Execution, Deployment > Compiler

There I've removed the --offline in Command-line Options. Earlier I was trying to speed up Android Studio a bit and this was one of the changes I had made.

Everything was fine after a restart then (and I have re-enabled both offline parts).

This problem occurs, if you have offline mode switched on in your IDE and let the IDE upgrade your build file to use 0.10.1 of the gradle plugin (that is needed for the new AS version. Since you have never build with this version, it cannot be found in the offline cache.

Go to File->Settings->Gradle (under Project Settings on the top) and disable the check in front of Offline Work (Section 'Global Gradle settings' at the bottom). Now it can download the version with the next build and afterwards you are free to use offline mode again, if you wish so.

Disable offline mode to solve this error.

In Android studio:

File -> Other Settings -> Default Settings -> Build,Execution,Deployment -> Build Tools -> Gradle

Then uncheck Offline work and sync again.

Hope your issue will resolved.

I had the same problem in Android Studio v3.2.1.

This is working for me.

I updated Gradle version in build.gradle

 dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'//same as Android Studio vesion           
 }

and changed distributionUrl in gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

to

distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

I thought I should post the latest update on where you should be able to find the option to disable your Offline Work in IntelliJ.

It's under your Preferences -> Build, Execution, Deployment

Uncheck Offline work and you should be fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!