Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle Sync Failed Android Studio 3.6 [duplicate]

I have just updated the Android Studio from 3.5.3 to 3.6. After this update, I have updated the Gradle and Android SDK Build Tools as well. Now the Gradle sync is failing with these errors:

1. org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException:
    Could not resolve all artifacts for configuration ':classpath'.
 2. org.gradle.internal.resolve.ModuleVersionResolveException: Could not
    resolve com.android.tools.build:gradle:3.6.0.
 3. org.gradle.internal.resolve.ModuleVersionResolveException: No cached
    version of com.android.tools.build:gradle:3.6.0 available for
    offline mode.

Looking at the 3rd error it seems that Offline Work option needs to be disabled in Android Studio Settings -> Build, Execution, Deployment -> Gradle. But the Offline Work check box is no where to be found in the said settings. Is it the actual problem? If yes, then how it could be disabled in Android Studio 3.6? If no, then what is the problem here?

I have already tried Invalidate Caches / Restart but it did not help.

like image 861
mhaseebn Avatar asked Feb 25 '20 11:02

mhaseebn


People also ask

Why does gradle Project Sync Fail?

In some cases when your Gradle files are deleted or corrupted you will not be able to download new Gradle files in android studio. In this case, we have to delete the Gradle files which are present already and then again sync your project to download our Gradle files again. For finding your .

How do I reset gradle sync?

Open your gradle. properties file in Android Studio. Restart Android Studio for your changes to take effect. Click Sync Project with Gradle Files to sync your project.


2 Answers

Run to the very same error a while ago. This worked for me.

From the Android Studio 3.6 new features blog post: New location to toggle Gradle's offline mode To enable or disable Gradle's offline mode, first select View > Tool Windows > Gradle from the menu bar. Then, near the top of the Gradle window, click Toggle Offline Mode Gradle offline button in the Gradle panel

Source: Cannot enable Gradle's offline mode on Android Studio 3.6

like image 185
llwh Avatar answered Oct 19 '22 15:10

llwh


Ran into the same issue and deleting ".idea" folder inside project directory and deleting ".gradle" directory from home helped me resolve the issue.

like image 36
Shubham Bansal Avatar answered Oct 19 '22 16:10

Shubham Bansal