根据此处的指南http://tools.android.com/tech-docs/new-build-system/user-guide
我有点疑惑。
例如,如果我将多项目设置为以下文件结构:
MyProject/
+ app/
+ libraries/
+ lib1/
+ lib2/
我们可以设置一个
settings.gradle
文件与 `include ':app', ':libraries:lib1', ':libraries:lib2'`
这些项目是我们自己创建的。
但,
ActionBarSherlock/
-settings.gradle
+actionBarSherlock
+actionBarSherlock-i18n
github-android/
- build.gradle
+ app
+ test
它们存在于具有不同根项目的不同父目录中。
我应该如何在
build.gradle
中分配编译项目路径? github android客户端如何获取相关库?dependencies {
compile project(':actionbarsherlock')
}
最佳答案
好的,我暂时放弃了 gradle 并选择 maven-android-plugin + Intellij 作为我最喜欢的小工具。
作为 Maven-android-plugin 入门:https://code.google.com/p/maven-android-plugin/wiki/GettingStarted提及:
If you have JUnit tests that don't call any Android APIs (directly or transitively), put them in src/test/java so JUnit runs them locally and more quickly than if run on the device.
我将我的 Robolectric+Junit 放在主应用模块的 src/test 和测试模块的 Instrument Test 中。
目前,我觉得他们工作得很好。
关于android - 用 gradle 构建 android 的最佳实践是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17198558/