0

Android: Update docs for auto import.

Android studio requires additional configuration to enable automatic
imports on the fly.

Also fix some markdown formatting, 4-space tabs necessary for sublists.

BUG=667858

Review-Url: https://codereview.chromium.org/2530903003
Cr-Commit-Position: refs/heads/master@{#434370}
This commit is contained in:
wnwen
2016-11-24 10:47:31 -08:00
committed by Commit bot
parent 0da6f15bd0
commit d65703a80b

@@ -23,18 +23,18 @@ build/android/gradle/generate_gradle.py --output-directory out-gn/Debug --target
For first-time Android Studio users: For first-time Android Studio users:
* Avoid running the setup wizard. * 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 skip it, select "Cancel" when it comes up.
To import the project: To import the project:
* Use "Import Project", and select the directory containing the generated project. * Use "Import Project", and select the directory containing the generated project.
You need to re-run `generate_gradle.py` whenever `BUILD.gn` files change. 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 * Help -> Find Action -> "Sync Project with Gradle Files"
## How it Works ## How it Works
@@ -67,24 +67,27 @@ includes `R.java`).
## Android Studio Tips ## Android Studio Tips
* Configuration instructions can be found [here](http://tools.android.com/tech-docs/configuration). One suggestions: * 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` * 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*/` * If you ever need to reset it: `rm -r ~/.AndroidStudio*/`
* Import Android style settings: * Import Android style settings:
* Help -> Find Action -> Code Style -> Java -> Manage -> Import * Help -> Find Action -> "Code Style" (settings) -> Java -> Manage -> Import
* Select `third_party/android_platform/development/ide/intellij/codestyles/AndroidStyle.xml` * Select `third_party/android_platform/development/ide/intellij/codestyles/AndroidStyle.xml`
* Turn on automatic import:
* Help -> Find Action -> "Auto Import"
* Tick all the boxes under "Java" and change the dropdown to "All".
### Useful Shortcuts ### Useful Shortcuts
* `Shift - Shift`: Search to open file or perform IDE action * `Shift - Shift`: Search to open file or perform IDE action
* `Ctrl + N`: Jump to class * `Ctrl + N`: Jump to class
* `Ctrl + Shift + T`: Jump to test * `Ctrl + Shift + T`: Jump to test
* `Ctrl + Shift + N`: Jump to file * `Ctrl + Shift + N`: Jump to file
* `Ctrl + F12`: Jump to method * `Ctrl + F12`: Jump to method
* `Ctrl + G`: Jump to line * `Ctrl + G`: Jump to line
* `Shift + F6`: Rename variable * `Shift + F6`: Rename variable
* `Ctrl + Alt + O`: Organize imports * `Ctrl + Alt + O`: Organize imports
* `Alt + Enter`: Quick Fix (use on underlined errors) * `Alt + Enter`: Quick Fix (use on underlined errors)
### Building from the Command Line ### Building from the Command Line
@@ -97,21 +100,21 @@ This wrapper can also be used to invoke gradle commands.
The resulting artifacts are not terribly useful. They are missing assets, The resulting artifacts are not terribly useful. They are missing assets,
resources, native libraries, etc. resources, native libraries, etc.
* Use a [gradle daemon](https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html) to speed up builds: * 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. * Add the line `org.gradle.daemon=true` to `~/.gradle/gradle.properties`, creating it if necessary.
## Status (as of Sept 21, 2016) ## Status (as of Sept 21, 2016)
### What works ### What works
* Tested with Android Studio v2.2. * Tested with Android Studio v2.2.
* Basic Java editing and compiling works. * Basic Java editing and compiling works.
### What doesn't work (yet) ([crbug](https://bugs.chromium.org/p/chromium/issues/detail?id=620034)) ### What doesn't work (yet) ([crbug](https://bugs.chromium.org/p/chromium/issues/detail?id=620034))
* Better support for instrumentation tests (they are treated as non-test .apks right now) * Better support for instrumentation tests (they are treated as non-test .apks right now)
* Make gradle aware of resources and assets * Make gradle aware of resources and assets
* Make gradle aware of native code via pointing it at the location of our .so * Make gradle aware of native code via pointing it at the location of our .so
* Add a mode in which gradle is responsible for generating `R.java` * Add a mode in which gradle is responsible for generating `R.java`
* Add support for native code editing * Add support for native code editing
* Make the "Make Project" button work correctly * Make the "Make Project" button work correctly