如何升级as as设置gradle版本本

44被浏览57,075分享邀请回答println("I'm now compiling with gradle " + project.gradle.gradleVersion);
sync 一下,再编译的时候,Gradle Console 里就会告诉你当前在用哪个版本了。Plugin 同理可以get到。41 条评论分享收藏感谢收起Android Studio 打包apk,自动追加版本号和版本名称
默认AS大包好的apk是app-deubg.apk的,这样的话版本多了找出一个bug在哪个版本中存在的,就非常的麻烦了,我们追加版本号和版本名称后就非常好区分了。
在gradle文件中的android节点下添加如下代码
android.applicationVariants.all {
variant -& variant.outputs.each {
output -& output.outputFile = new File(output.outputFile.parent, &DialogTest_& + defaultConfig.versionCode +
&_v& + defaultConfig.versionName +&_&+buildType.name+ &.apk&);How to update gradle in android studio - Stack Overflow
Join Stack Overflow to learn, share knowledge, and build your career.
or sign in with
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.
13.6k94789
2,31463461
Update gradle easily (Updated November 2017):
Step 1 (Use default gradle wrapper)
File→Settings→Build, Execution, Deployment→Build Tools→Gradle→Use default Gradle wrapper (recommended)
Step 2 (Select desired gradle version)
File→Project Structure→Project
The following table shows which version of Gradle is compatible with specific
version of Android plugin for Gradle:
Latest versions you can use with Android Studio 3 (November 2017):
Plugin version: 3.0.0
Gradle version: 4.2
Official links
6,77663850
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:
(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
after release of android studio v 3.0(stable), It will show popup, If gradle update is available
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
2.2.1 - 2.13
2.0.0 - 2.1.2
2.1.3 - 2.2.3
13.6k94789
Open File > Project Structure > Project Tab
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.
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
On Mac, open terminal and run the following commands as per :
$ curl -s https://get.sdkman.io | bash
$ 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
2,74512531
For those who still have this problem (to example to switch from 2.8.0 to 2.10.0), move to file gradle-wrapper.properties and set distributionUrl like way.
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
I changed 2.8.0 to 2.10.0 and dont forget to Sync after
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:
(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
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
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.
1,66611925
If your run button is gray. This is how i fixed it.
Go to Run in menu, and then press this:
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.
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabled}

我要回帖

更多关于 as gradle 版本 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信