Ubuntu官方源的Gradle太陈旧了。。。陈旧到不支持Android Studio的 jcenter方法,如果强行编译,会出现如下错误:
Could not find method jcenter() for arguments [] on repository Container.
所以,起码到现在(2016-10-8), 不要用 sudoapt−getinstallgradle来安装gradle,如果安装了,要用 sudo apt-get remove gradle卸载掉
http://www.gradle.org/downloads 下载
解压
配置
/etc/profile
export GRADLE_HOME=/opt/gradle/gradle-2.6
export PATH=$GRADLE_HOME/bin:$PATH
然后source profile 就可以了
验证一下
$ gradle -v
//将显示如下:
------------------------------------------------------------
Gradle 3.1
------------------------------------------------------------
Build time: 2016-09-19 10:53:53 UTC
Revision: 13f38ba699afd86d7cdc4ed8fd7dd3960c0b1f97
Groovy: 2.4.7
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_73 (Oracle Corporation 25.73-b02)
OS: Linux 3.13.0-91-generic amd64
//恭喜安装成功