16

The error is the following:

Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all artifacts for configuration ':classpath'.

Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:3.6.1.

Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: No cached version of com.android.tools.build:gradle:3.6.1 available for offline mode.
Glastis
  • 163
  • 4
  • 15
Harish Kumar
  • 161
  • 1
  • 2
  • 4

6 Answers6

21

It is a problem found in the new Android Studio 3.6 update. But it is basically not a problem.

All you have to do is the following:
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

Here are some screenshots:

  1. First go here
  2. Toggle this option
Asif Iqbal
  • 219
  • 1
  • 4
  • This helped me I setup offline mode before upgrading to 3.6. Then when 3.6 opened the checkbox for offline mode was gone in Preferences menu. Thank you so much! – Rio Marie A. Callos Mar 01 '20 at 14:13
  • After Toggle offline mode, make a gradle sync it will tell you what to do in the rest. Thank you for the help @Asif Iqbal – user7418129 Mar 27 '20 at 04:47
10

I was going through similar issues last night, this is what worked for me :

Open the build.gradle file from your app folder, it should look similar to this

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.1'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

add google() to repositories in -buildscript and -allprojects, just like here :

buildscript {
    repositories {
        google()       // here
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.1'
    }
}

allprojects {
    repositories {
        google()      //and here
        jcenter()
    }
}

In Android Studio, go to File -> Project Structure.. [ shortcut : Ctrl + Alt + Shift + S ]

In the Project tab -> Android Gradle Plugin Version -> 3.6.1 and Gradle Version -> 5.6.4 |||

Last, under the Module tab, make sure the compile sdk version is > 14 (ie: 25, 28 or 29..)

Koch
  • 555
  • 4
  • 15
5

solution is to enable gradle as highlighted in below picture: enter image description here

0

I opened an old project with Eclipse. For me, it helped to add the following in build.gradle:

apply plugin: 'com.android.application'

repositories {
    // order may be important!
    google()
    jcenter()
} 

Source: https://stackoverflow.com/a/50285646/1097104

In addition, a few times I had to use File > Invalidate Caches / Restart.

Juuso Ohtonen
  • 8,826
  • 9
  • 65
  • 98
0

If you are using Android Latest version Chipmunk. Then this solution for you.

step 1. Open Gradle Setting and copy gradlePluginPortal() and paste it in dependencyResolutionManagement below.

step 2. Change RepositoriesMode.PREFER_SETTINGS like this step 3. enable android.enableJetifier=true

follow the above step then definetelly solve your issue.

-1

The project that you are trying to build probably doesn't have the required SDK version. You can download it from the Android Studio within the "Preferences" dialog, under Appearance & Behavior → System Settings → Android SDK. Preferences Screenshot.