| Index: docs/android_studio.md
|
| diff --git a/docs/android_studio.md b/docs/android_studio.md
|
| index 2a10aa7a8c89d39a08bbf66242405ea7f3a229f9..2815238f69169f34364c32c8e5beb315b782f555 100644
|
| --- a/docs/android_studio.md
|
| +++ b/docs/android_studio.md
|
| @@ -4,7 +4,8 @@
|
|
|
| ## Usage
|
|
|
| -Make sure you have followed [android build instructions](android_build_instructions.md) already.
|
| +Make sure you have followed
|
| +[android build instructions](android_build_instructions.md) already.
|
|
|
| ```shell
|
| build/android/gradle/generate_gradle.py
|
| @@ -26,16 +27,19 @@ build/android/gradle/generate_gradle.py --target //some:target_apk --target //so
|
| For first-time Android Studio users:
|
|
|
| * Avoid running the setup wizard.
|
| - * The wizard will force you to download unwanted SDK components to `//third_party/android_tools`.
|
| + * The wizard will force you to download unwanted SDK components to
|
| + `//third_party/android_tools`.
|
| * To skip it, select "Cancel" when it comes up.
|
|
|
| To import the project:
|
|
|
| -* Use "Import Project", and select the directory containing the generated project, by default `out-gn/Debug/gradle`.
|
| +* Use "Import Project", and select the directory containing the generated
|
| + project, by default `out-gn/Debug/gradle`.
|
|
|
| You need to re-run `generate_gradle.py` whenever `BUILD.gn` files change.
|
|
|
| -* After regenerating, Android Studio should prompt you to "Sync". If it doesn't, use:
|
| +* After regenerating, Android Studio should prompt you to "Sync". If it
|
| + doesn't, use:
|
| * Help -> Find Action -> "Sync Project with Gradle Files"
|
|
|
|
|
| @@ -45,17 +49,13 @@ Android Studio integration works by generating `build.gradle` files based on GN
|
| targets. Each `android_apk` and `android_library` target produces a separate
|
| Gradle sub-project.
|
|
|
| -### Symlinks and .srcjars
|
| +### Excluded files and .srcjars
|
|
|
| Gradle supports source directories but not source files. However, some
|
| -`java/src/` directories in Chromium are split amonst multiple GN targets. To
|
| -accommodate this, the script detects such targets and creates a `symlinked-java/`
|
| -directory to point gradle at. Be warned that creating new files from Android
|
| -Studio within these symlink-based projects will cause new files to be created in
|
| -the generated `symlinked-java/` rather than the source tree where you want it.
|
| -
|
| -*** note
|
| -** TLDR:** Always create new files outside of Android Studio.
|
| +directories in Chromium are split amonst multiple GN targets. To accommodate
|
| +this, the script detects such targets and creates exclude patterns to exclude
|
| +files not in the current target. You may still see them when editing, but they
|
| +are excluded in gradle tasks.
|
| ***
|
|
|
| Most generated .java files in GN are stored as `.srcjars`. Android Studio does
|
| @@ -69,11 +69,14 @@ includes `R.java`).
|
|
|
| ## Android Studio Tips
|
|
|
| -* Configuration instructions can be found [here](http://tools.android.com/tech-docs/configuration). One suggestions:
|
| - * Launch it with more RAM: `STUDIO_VM_OPTIONS=-Xmx2048m /opt/android-studio-stable/bin/studio-launcher.sh`
|
| +* Configuration instructions can be found
|
| + [here](http://tools.android.com/tech-docs/configuration). One suggestions:
|
| + * Launch it with more RAM:
|
| + `STUDIO_VM_OPTIONS=-Xmx2048m /opt/android-studio-stable/bin/studio-launcher.sh`
|
| * If you ever need to reset it: `rm -r ~/.AndroidStudio*/`
|
| * Import Android style settings:
|
| - * Help -> Find Action -> "Code Style" (settings) -> Java -> Manage -> Import
|
| + * Help -> Find Action -> "Code Style" (settings) -> Java ->
|
| + Manage -> Import
|
| * Select `third_party/android_platform/development/ide/intellij/codestyles/AndroidStyle.xml`
|
| * Turn on automatic import:
|
| * Help -> Find Action -> "Auto Import"
|
| @@ -97,17 +100,20 @@ includes `R.java`).
|
|
|
| ### Building from the Command Line
|
|
|
| -Gradle builds can be done from the command-line after importing the project into
|
| -Android Studio (importing into the IDE causes the Gradle wrapper to be added).
|
| -This wrapper can also be used to invoke gradle commands.
|
| +Gradle builds can be done from the command-line after importing the project
|
| +into Android Studio (importing into the IDE causes the Gradle wrapper to be
|
| +added). This wrapper can also be used to invoke gradle commands.
|
|
|
| cd $GRADLE_PROJECT_DIR && bash gradlew
|
|
|
| The resulting artifacts are not terribly useful. They are missing assets,
|
| resources, native libraries, etc.
|
|
|
| -* Use a [gradle daemon](https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html) to speed up builds:
|
| - * Add the line `org.gradle.daemon=true` to `~/.gradle/gradle.properties`, creating it if necessary.
|
| +* Use a
|
| + [gradle daemon](https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html)
|
| + to speed up builds using the gradlew script:
|
| + * Add the line `org.gradle.daemon=true` to `~/.gradle/gradle.properties`,
|
| + creating it if necessary.
|
|
|
| ## Status (as of Jan 19, 2017)
|
|
|
|
|