[android] How to update gradle in android studio?

I installed Android Studio 0.1.9. Today I got and update to version 0.2 and of course I updated. After the installation I restarted Android Studio but now I get this message:

Project is using an old version of the Android Gradle plug-in. The minimum supported version is 0.5.0. Please update the version of the dependency 'com.android.tools.build:gradle'

How do I do that? I can't find any update tools for the gradle plugin in android studio.

This question is related to android android-studio gradle shortcut

The answer is


Open your root build.gradle file and change Gradle version like this

Old version:

 dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
    } 

New version:

dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
    }

For Gradle version compatibility see this.


Open File > Project Structure > Project Tab

enter image description here

Android Studio has built in project structure menu to check and update gradle and plugin used in the current project.

Below Website gives a detailed explanation on how to update gradle and gradle plugin of Android Studio.

Update gradle plugin Android Studio


It works for me:

just go to '/home/your-user/.gradle/wrapper/dists/'

delete everything inside of this

It will be replaced by android studio

on terminal run: ionic emulate android

Its all...


For me I copied my fonts folder from the assets to the res folder and caused the problem because Android Studio didn't accept capitalized names. I switched to project view mode and deleted it then added it as font resource file by right clicking res folder.


Go to File > Settings > Builds,Execution,Deployment > Build Tools > Gradle >Gradle home path

Now, set Use default gradle wrapper and edit Project\gradle\wrapper\gradle-wrapper.properties files field distributionUrl like this

distributionUrl=https://services.gradle.org/distributions/gradle-2.10-all.zip


This may not be the exact answer for the OP, but is the answer to the Title of the question: How to Update Gradle in Android Studio (AS):

  • Get latest version supported by AS: http://www.gradle.org/downloads (Currently 1.9, 1.10 is NOT supported by AS yet)
  • Install: Unzip to anywhere like near where AS is installed: C:\Users[username]\gradle-1.9\
  • Open AS: File->Settings->Gradle->Service directory path: (Change to folder you set above) ->Click ok. Status on bottom should indicate it's busy & error should be fixed. Might have to restart AS

Select android\gradle\wrapper and open gradle-wrapper.properties

change: distributionUrl=https://services.gradle.org/distributions/gradle-older-version-to-new-version.zip

eg: distributionUrl=https://services.gradle.org/distributions/gradle-5.1.1-all.zip and rebuild your project


Most of the time you can have Android Studio automatically update the Gradle plugin.

If your Gradle plugin version is behind, Instant Run will mostly likely not work. Therefore if you go to the Instant Run settings (Preferences > Build, Execution, Deployment > Instant Run), you'll see an Update project button at the top right (image below). Clicking this will update both the Gradle wrapper and build tools. Update Project


I can't comment yet.

Same as Kevin but with different UI step:

This may not be the exact answer for the OP, but is the answer to the Title of the question: How to Update Gradle in Android Studio (AS):

  • Get latest version supported by AS: http://www.gradle.org/downloads (Currently 1.9, 1.10 is NOT supported by AS yet)
  • Install: Unzip to anywhere like near where AS is installed: C:\Users[username]\gradle-1.9\
  • Open AS: File->Settings->Build, Execution, Deployment->Build Tools-> Gradle->Service directory path: (Change to folder you set above) ->Click ok. Status on bottom should indicate it's busy & error should be fixed. Might have to restart AS

For those who still have this problem (for example to switch from 2.8.0 to 2.10.0), move to the file gradle-wrapper.properties and set distributionUrl like that.

distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

I changed 2.8.0 to 2.10.0 and don't forget to Sync after


If your run button is gray. This is how i fixed it.

Go to Run in menu, and then press this:

enter image description here

Then it will run your Emulator, and your run button will become green again and you can use it. That is how i fixed it.


after release of android studio v 3.0(stable), It will show popup, If gradle update is available

OR

Manually, just change version of gradle in top-level(project-level) build.gradle file to latest,

   buildscript {
      ...
      dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
      }
    }

check below chart

The Android Gradle Plugin and Gradle

 Android Gradle Plugin            Requires Gradle
 1.0.0 - 1.1.3                    2.2.1 - 2.3
 1.2.0 - 1.3.1                    2.2.1 - 2.9
 1.5.0   2.2.1+                   2.2.1 - 2.13
 2.0.0 - 2.1.2                    2.10  - 2.13
 2.1.3 - 2.2.3                    2.14.1+
 2.3.0+                           3.3+
 3.0.0+                           4.1+    
 3.1.0+                           4.4+    
 3.2.0 - 3.2.1                    4.6+    
 3.3.0 - 3.3.1                    4.10.1+ 
 3.4.0 - 3.4.1                    5.1.1+
 3.5.0                            5.4.1+

check gradle revisions


On Mac, open terminal and run the following commands as per instructions:

$ curl -s https://get.sdkman.io | bash

then

$ sdk install gradle 3.0

Once the installation is complete, the terminal would ask whether to set it as a default version so type y and make it the default version.

Now open Android Studio -> Terminal and run the following command

Gradle --version

Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to android-studio

A failure occurred while executing com.android.build.gradle.internal.tasks "Failed to install the following Android SDK packages as some licences have not been accepted" error Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Flutter plugin not installed error;. When running flutter doctor ADB.exe is obsolete and has serious performance problems Android design support library for API 28 (P) not working Flutter command not found How to find the path of Flutter SDK

Examples related to gradle

Gradle - Move a folder from ABC to XYZ A failure occurred while executing com.android.build.gradle.internal.tasks Gradle: Could not determine java version from '11.0.2' Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0 Failed to resolve: com.android.support:appcompat-v7:28.0 Failed to resolve: com.google.firebase:firebase-core:16.0.1 com.google.android.gms:play-services-measurement-base is being requested by various other libraries java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion Error - Android resource linking failed (AAPT2 27.0.3 Daemon #0)

Examples related to shortcut

Collapse all methods in Visual Studio Code How do I create a shortcut via command-line in Windows? window.close() doesn't work - Scripts may close only the windows that were opened by it How to automatically generate getters and setters in Android Studio How to update gradle in android studio? Is there a short cut for going back to the beginning of a file by vi editor? How to create a shortcut using PowerShell How do I call a function twice or more times consecutively? Eclipse comment/uncomment shortcut? 2D array values C++