AndroidStudio使用全新的構建系列—–Gradle。
這是官方為什么使用gradle 的理由:
- Domain Specific Language (DSL) to describe and manipulate the build logic
- Build files are Groovy based and allow mixing of declarative elements through the DSL and using code to manipulate the DSL elements to provide custom logic.
- Built-in dependency management through Maven and/or Ivy.
- Very flexible. Allows using best practices but doesn’t force its own way of doing things.
- Plugins can expose their own DSL and their own API for build files to use.
- Good Tooling API allowing IDE integration
在Ubuntu安裝Gradle也是很簡單。切記請勿使用apt-get安裝Gradle。因為Ubuntu源的Gradle實在太舊。我用的搜狐的源,竟然是2011年。
下面是安裝步驟:
1、在官網下載最新的Gradle版本。http://www.gradle.org/downloads
2、解壓安裝包到目錄
3、
打開環境文件
sudo vim /etc/profile
4、寫入環境變量:
export
GRADLE_HOME=/opt/gradle/gradle-2.0
export PATH=$GRADLE_HOME
/bin
:$PATH
5、環境變量生效source /etc/profile
6、檢查結果
gradle -v