Android: Remove apk modules for Android Studio
It is no longer necessary to list all the apk targets as separate
modules now that we have the _all pseudo module. Having the separate
modules resulted in bugs where Android Studio could not distinguish
between prod code and test code since some modules viewed dirs as prod
and some as test. The --split-projects flag can be used to see the
dependency graph, and when only a single module will be generated, the
_all pseudo module will not replace it.
For android studio's _all pseudo module, move all known test dirs to
androidTest instead of main so that they are properly displayed when
filtered.
BUG=620034
Review-Url: https://codereview.chromium.org/2837863002
Cr-Commit-Position: refs/heads/master@{#467704}
diff --git a/docs/android_studio.md b/docs/android_studio.md
index 6a87f97..517223c6 100644
--- a/docs/android_studio.md
+++ b/docs/android_studio.md
@@ -24,12 +24,6 @@
build/android/gradle/generate_gradle.py --extra-target //chrome/android:chrome_public_apk
```
-For those upgrading from Android Studio 2.2 to 2.3:
-
-* Use `gn clean` and `gn gen`
-* Clean up in `//third_party/android_tools` with `git clean -ffd`.
-* Remove project from android studio and regenerate with `generate_gradle.py`.
-
For first-time Android Studio users:
* Avoid running the setup wizard.
@@ -37,6 +31,12 @@
`//third_party/android_tools`.
* To skip it, select "Cancel" when it comes up.
+For those upgrading from Android Studio 2.2 to 2.3:
+
+* Use `gn clean` and `gn gen`
+* Clean up in `//third_party/android_tools` with `git clean -ffd`.
+* Remove project from android studio and regenerate with `generate_gradle.py`.
+
To import the project:
* Use "Import Project", and select the directory containing the generated
@@ -52,9 +52,14 @@
## How It Works
-Android Studio integration works by generating `build.gradle` files based on GN
-targets. Each valid target produces a separate Gradle sub-project.
-Instrumentation tests are combined with their `apk_under_test`.
+By default, only a single module is generated. If more than one apk target is
+specified, then an `_all` module is generated. Otherwise a single apk module is
+generated. Since instrumentation tests are combined with their `apk_under_test`
+target, they count as one module together.
+
+To see more detailed structure of gn targets, the `--split-projects` flag can
+be used. This will generate one module for every gn target in the dependency
+graph.
### Excluded Files
@@ -127,7 +132,7 @@
* Add the line `org.gradle.daemon=true` to `~/.gradle/gradle.properties`,
creating it if necessary.
-## Status (as of April 19th, 2017)
+## Status (as of April 27th, 2017)
### What works
@@ -139,6 +144,7 @@
* Java debugging (see
[here](/docs/android_debugging_instructions.md#Android-Studio)).
* Import resolution and refactoring across all modules.
+* Correct lint and AndroidManifest when only one target is specified.
### What doesn't work (yet) ([crbug](https://bugs.chromium.org/p/chromium/issues/detail?id=620034))