Android Studio 3.1.2 Gradle Error : Could not resolve all files for configuration ':lintClassPath'

5.3k Views Asked by At

I am on mac, using android studio 3.1.2 . I have changed the gradle version to 4.4 and Android plugin to 3.1.2 I have already changed the compile keyword to implementation in the build.gradle

I am getting this error :

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':lint'.
> Could not resolve all files for configuration ':lintClassPath'.
   > Could not find com.android.tools:sdk-common:26.1.2.
     Searched in the following locations:
         file:/Users/rp/Library/Android/sdk/extras/m2repository/com/android/tools/sdk-common/26.1.2/sdk-common-26.1.2.pom
         file:/Users/rp/Library/Android/sdk/extras/m2repository/com/android/tools/sdk-common/26.1.2/sdk-common-26.1.2.jar

how can this be fixed?

1

There are 1 best solutions below

0
sdeng On

The cause of this issue is that Gradle can't find the Android SDK. There are several ways to fix it:

  1. Define the ANDROID_HOME environment variable

    ANDROID_HOME=your/path/to/android/sdk; export ANDROID_HOME

or Add sdk.dir to the file local.properties, for example on my Linux computer

sdk.dir=/home/sdeng/Android/Sdk

  1. if you already defined ANDROID_HOME or sdk.dir, it still happens. It probably something is wrong with the specific version of your Android SDK or Gradle daemon. Try to kill all Gradle processes, re-download the specific version of Android SDK.

    Or you can check the SDK at $ANDROID_HOME/platforms/android-28, where 28 is the compileSdkVersion defined in build.gradle Like other comment says, change to a good SDK version works in this case.