【发布时间】:2015-01-09 04:40:54
【问题描述】:
我是 Android Studio 和 Gradle 的新手。
我的项目结构是这样的:
MyProject
-LibModuleOne
-...
-build.gradle
-LibModuleTwo
- ...
-buld.gradle
-AppModule
-...
-build.gradle
buld.gradle
在命令行上,在 MyProject/ 下,./gradlew --version 显示我正在使用 gradle 2.1:
./gradlew --version
------------------------------------------------------------
Gradle 2.1
------------------------------------------------------------
Build time: 2014-09-08 10:40:39 UTC
Build number: none
Revision: e6cf70745ac11fa943e19294d19a2c527a669a53
Groovy: 2.3.6
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.8.0_25 (Oracle Corporation 25.25-b02)
OS: Mac OS X 10.8.5 x86_64
但是,如果我检查 MyProject/LibModuleOne/ 或 MyProject/LibModuleTwo/ 或 MyProject/AppModule/ 下的版本,它们都会显示给我我正在使用 gradle 1.12:
./gradlew --version
------------------------------------------------------------
Gradle 1.12
------------------------------------------------------------
Build time: 2014-04-29 09:24:31 UTC
Build number: none
Revision: a831fa866d46cbee94e61a09af15f9dd95987421
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
Ivy: 2.2.0
JVM: 1.8.0_25 (Oracle Corporation 25.25-b02)
OS: Mac OS X 10.8.5 x86_64
project root的build.gradle声明使用Android插件version0.13.3:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.3'
}
}
在Android studio中,File-->Project structure-->显示Gradle 2.1
为什么 gradle wrapper 在子模块中显示的版本与项目根目录不同?如何让我的所有子模块都使用 Gradle 2.1?
【问题讨论】:
标签: android gradle android-studio android-gradle-plugin gradlew