- 添加模块依赖:
compile project(":library")
- 添加子目录下的模块:
compile project(“:libraries:library”)
Gradle总是从根目录开始查找build.gradle,一个build.gradle表示一个Gradle项目。
:
用作路径分隔符。settings.gradle
使用同样的路径格式。 - Gradle会为每个Module生成Tasks。如果在一个Module路径下执行Gradle Wrapper命令,任务只针对当前Module。
- 项目根目录下执行特定Module的命令:
gradlew :wear:assembleDebug
。 - Android Wear项目同样使用Application插件:
1 | apply plugin: ‘com.android.Application’ |
Android Wear项目依赖:
1
2
3
4
5dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:1.1.0'
compile 'com.google.android.gms:play-services-wearable:6.5.87'
}在Android应用项目中依赖Wear模块。
1
2
3dependences {
wearApp project(':wear')
}GAE 目前已经可以用Firebase替代GAE了,官网:Firebase
- 多模块并行构建:
1
2// gradle.properties文件
org.gradle.parallel=true
其他文章