How to check the gradle version in Android Studio?

2019-01-30 13:16发布

问题:

When compiling this official project with Android Studio 0.82, it shows error note:

Error:The project is using an unsupported version of the Android Gradle plug-in (0.9.2)

After some searching, I decide to manually change content in the build.gradle file in line

classpath 'com.android.tools.build:gradle:0.9.+'

to the gradle version that is installed in Android Studio.

The question is, can how to check the gradle version in my Android Studio?

回答1:

File->Project Structure->Project pane->"Android plugin version".

Make sure you don't confuse the Gradle version with the Android plugin version. The former is the build system itself, the latter is the plugin to the build system that knows how to build Android projects



回答2:

Image shown below. I'm only typing this because of a 30 character minimum imposed by Stackoverflow.



回答3:

  1. Create new project in Android studio;

  2. Press Ctrl+Shift+Alt+S

  3. Proceed to "Project" section

  4. You can see actual gradle version and android pluging version. Copy that to your project.



回答4:

I'm not sure if this is what you ask, but you can check gradle version of your project here in android studio:

(left pane must be in project view, not android for this path) app->gradle->wrapper->gradle-wrapper.properties

it has a line like this, indicating the gradle version:

distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-all.zip

There is also a table at the end of this page that shows gradle and gradle plug-in versions supported by each android studio version. (you can check your android studio by checking help->about as you may already know)



回答5:

You can install andle for gradle version management.

It can help you sync to the latest version almost everything in gradle file.

Simple three step to update all project at once.

1. install:

    $ sudo pip install andle

2. set sdk:

    $ andle setsdk -p <sdk_path>

3. update depedency:

    $ andle update -p <project_path> [--dryrun] [--remote] [--gradle]

--dryrun: only print result in console

--remote: check version in jcenter and mavenCentral

--gradle: check gradle version

See https://github.com/Jintin/andle for more information