1

Could not find gradle.jar (com.android.tools.build:gradle:3.1.3). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.3/gradle-3.1.3.jar

I am getting this error while creating a new project in Android Studio 3.1.3

Shashanth
  • 4,995
  • 7
  • 41
  • 51
Dr. Ahmad
  • 13
  • 5
  • Possible duplicate: https://stackoverflow.com/questions/49732366/android-studio-3-1-could-not-find-gradle-core-jar-gradle-core-3-1-0-jar – Gabriel Devillers Aug 07 '18 at 18:16
  • 1
    @GabrielDevillers it can not be a dupe of that, there are no upvoted answers – James Jenkins Aug 07 '18 at 18:18
  • I guess it would be helpful to add some more context information and stating in what step this happens and what you already tried to do. – sim Aug 07 '18 at 18:30
  • Please post your build.gradle file to help debug this. Also, gradle 3.1.4 was just released as the new default for the latest Android Studio so maybe try using that version instead and updating Android Studio too. – CodeSmith Aug 07 '18 at 21:03
  • Sync your project. It will force AS to download a requested version of Gradle. If this doesn't help, then exit AS and open it again. – Flot2011 Aug 07 '18 at 21:06
  • Possible duplicate of [Could not find com.android.tools.build:gradle:3.0.0-alpha1 in circle ci](https://stackoverflow.com/questions/44071080/could-not-find-com-android-tools-buildgradle3-0-0-alpha1-in-circle-ci) – Martin Zeitler Aug 07 '18 at 21:09
  • add repository `google()` instead of `url {https://maven.google.com}` to the `build.gradle`. and next time, please consider to search first, and/or add a `build.gradle`; else it often may be difficult to understand your question, due to lack of details. – Martin Zeitler Aug 07 '18 at 21:11

2 Answers2

0

The default gradle install is part of Android Studio sdk so if you moved your Android Studio files location or have the wrong PATH defined in your environment it won't find the sdk location like this. If your path is to a different android studio installation version it might not have that particular version of gradle in it.

CodeSmith
  • 1,621
  • 1
  • 13
  • 31
0

I show my solution in Android 3.2.1. Go to the file gradle-wrapper.properties and the line "distributionUrl" to change the version of gradle that you use, in my case i use "distributionUrl=https://services.gradle.org/distributions/gradle-3.2.1-all.zip" enter image description here

Go to also File -> Setting -> Gradle and Select "Use default gradle wrapper (recommended)" enter image description here

Change also in the buil.gradle(Project:TutorialKotlin) the line "classpath 'com.android.tools.build:gradle:3.2.1'" enter image description here

Andy Romero
  • 425
  • 5
  • 12