Hello! I have such a problem when I go to File-> Project Structure-> Project there is Gradle Version 2.10, but when I type a command in the terminal gradle --version it shows version 1.4 and Gradle works with this version (1.4). The build.gradle has a classpath 'com.android.tools.build:gradle:2.0.0'. How do i upgrade the gradle version?

    2 answers 2

    The gradle --version command displays the version of the hail installed in the system, while building the project, the so-called gradle wrapper is usually used, it was his version that you saw on the File-> Project Structure-> Project page. To work with it from the console, go to the root folder of the project and use the command gradlew (or if you have Mac OS or Linux, then ./gradlew ) instead of the gradle command.

      line from build.gradle :

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

      This is not Gradle itself, but a plugin for Android Studio, written by Google. It manages the interaction between IDE and Gradle. The latest current stable version is 2.1.0. You can see here

      The version of Gradle itself for the project is indicated in the file gradle-wrapper.properties in the line:

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

      current latest stable version 2.13 (you can see here )

      Having specified this line, the studio will download the required version if it is missing and will be used to build the project by default.

      You can do the same through the AS tools by following the path: File -> Project Structure -> Project and specifying the desired versions in the appropriate fields by editing them. After clicking the OK button, the corresponding configuration files will be changed: scrn

      To accept the changes you need to do: Tools -> Android -> Sync Project with Gradle files

      In the settings you need to specify to use the default wrapper version:

      File -> Settings -> Build, Execution, Deployment -> Gradle -> Project-Level settings: use default wrapper (recommended)

      The official guide on the issue (here you can also see the current version of the plug-in and wrapper).

      Periodically, the studio can display notifications about the need to update the plug-in or wrapper, they should be taken, as it is the most simple to maintain the current version.