Update gradle to 4.1 in Android Studio

My Android studio shows me the following window every time I start

enter image description here

So I decided to update it. After clicking update in Android Studio build.gradle , the project will open. I am changing the gradle version to 4.1 as suggested when popping up and click synchronize in Android Studio

 classpath 'com.android.tools.build:gradle:4.1' 

I see the following error

 Error:Could not find com.android.tools.build:gradle:4.1. Searched in the following locations: file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/4.1/gradle-4.1.pom file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/4.1/gradle-4.1.jar https://jcenter.bintray.com/com/android/tools/build/gradle/4.1/gradle-4.1.pom https://jcenter.bintray.com/com/android/tools/build/gradle/4.1/gradle-4.1.jar https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1/gradle-4.1.pom https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1/gradle-4.1.jar 

I checked C:\Program Files\Android\Android Studio\gradle\m2repository\com\android\tools\build\gradle and there is no folder inside 4.1 . Do I need to install it manually?

+5
source share
1 answer

Android-gradle-plugin version 4.1 is not yet released.

(Do not confuse with Gradle and the Android gradle plugin )

Currently, Android Studio 3.0.1 using Gradle-4.1 and Android-gradle-plugin 3.0.1

How I update gradle manually in Android Studio 3.0.1:

  • Find the gradle folder inside your project

    Open gradle-wrapper.properties and change

     distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 
  • Open the root build.gradle file and modify it in the buildscript file

     classpath 'com.android.tools.build:gradle:3.0.1' 
  • In addition, you need to add the google() repo link to the list of project repositories and the list of buildScript repositories.

     repositories { mavenLocal() mavenCentral() jcenter() google() //<- Add } 
+11
source

Source: https://habr.com/ru/post/1273640/


All Articles