天天看點

AndroidStudio的Gradle筆記

The Android build system uses the Android Plugin for Gradle to support

building Android applications with the Gradle build toolkit. The

plugin runs independent of Android Studio so the plugin and the Gradle

build system can be updated independently of Android Studio.

Gradle是獨立存在與AndroidStudio的,可以自己更新

When you update Android Studio, you may receive a prompt to

automatically update the Android Plugin for Gradle to the latest

available version. You can choose to accept the update or manually

specify a version based on your project’s build requirements.

AndroidStudio更新的時候你會收到Gradle的自動更新通知,也可以手動更新或者不更新

You can specify the Android Plugin for Gradle version in either the

File > Project Structure > Project menu in Android Studio, or the

top-level build.gradle file. The plugin version applies to all modules

built in that Android Studio project. The following example sets the

Android Plugin for Gradle to version 2.0.0 from the build.gradle file:

可以自定AndroidPlugin for Gradle通過以下方式:

1.File > Project Structure > Project > AndridPluginVersion

2.Project的build.gradle裡面

com.android.tools.build:gradle:1.5.0

Gradle

1.File > Project Structure > Project > GradleVersion

2.修改

gradle/wrapper/gradle-wrapper.properties

裡面的

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

修訂版

Android Plugin for Gradle, Revision 2.0.0

Dependencies:

Gradle  or higher.
Build Tools . or higher.
           

這個意思就是要用android plugin for gradle:2.0.0

必須要2.10以上的gradle版本(Gradle在AndroidStudio安裝路徑下)

和21.1.1以上的BuildToolsVersion(這個是在SDK路徑下)