| OLD | NEW |
| 1 # Android Studio | 1 # Android Studio |
| 2 | 2 |
| 3 [TOC] | 3 [TOC] |
| 4 | 4 |
| 5 ## Usage | 5 ## Usage |
| 6 | 6 |
| 7 ```shell | 7 ```shell |
| 8 build/android/gradle/generate_gradle.py --output-directory out-gn/Debug | 8 build/android/gradle/generate_gradle.py --output-directory out-gn/Debug |
| 9 ``` | 9 ``` |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 ``` | 22 ``` |
| 23 | 23 |
| 24 For first-time Android Studio users: | 24 For first-time Android Studio users: |
| 25 | 25 |
| 26 * Avoid running the setup wizard. | 26 * Avoid running the setup wizard. |
| 27 * The wizard will force you to download unwanted SDK components to `//third_
party/android_tools`. | 27 * The wizard will force you to download unwanted SDK components to `//third_
party/android_tools`. |
| 28 * To skip it, select "Cancel" when it comes up. | 28 * To skip it, select "Cancel" when it comes up. |
| 29 | 29 |
| 30 To import the project: | 30 To import the project: |
| 31 | 31 |
| 32 * Use "Import Project", and select the directory containing the generated projec
t. | 32 * Use "Import Project", and select the directory containing the generated projec
t, by default `out-gn/Debug/gradle`. |
| 33 | 33 |
| 34 You need to re-run `generate_gradle.py` whenever `BUILD.gn` files change. | 34 You need to re-run `generate_gradle.py` whenever `BUILD.gn` files change. |
| 35 | 35 |
| 36 * After regenerating, Android Studio should prompt you to "Sync". If it doesn't,
use: | 36 * After regenerating, Android Studio should prompt you to "Sync". If it doesn't,
use: |
| 37 * Help -> Find Action -> "Sync Project with Gradle Files" | 37 * Help -> Find Action -> "Sync Project with Gradle Files" |
| 38 | 38 |
| 39 | 39 |
| 40 ## How it Works | 40 ## How it Works |
| 41 | 41 |
| 42 Android Studio integration works by generating `build.gradle` files based on GN | 42 Android Studio integration works by generating `build.gradle` files based on GN |
| (...skipping 26 matching lines...) Expand all Loading... |
| 69 | 69 |
| 70 * Configuration instructions can be found [here](http://tools.android.com/tech-d
ocs/configuration). One suggestions: | 70 * Configuration instructions can be found [here](http://tools.android.com/tech-d
ocs/configuration). One suggestions: |
| 71 * Launch it with more RAM: `STUDIO_VM_OPTIONS=-Xmx2048m /opt/android-studio-
stable/bin/studio-launcher.sh` | 71 * Launch it with more RAM: `STUDIO_VM_OPTIONS=-Xmx2048m /opt/android-studio-
stable/bin/studio-launcher.sh` |
| 72 * If you ever need to reset it: `rm -r ~/.AndroidStudio*/` | 72 * If you ever need to reset it: `rm -r ~/.AndroidStudio*/` |
| 73 * Import Android style settings: | 73 * Import Android style settings: |
| 74 * Help -> Find Action -> "Code Style" (settings) -> Java -> Mana
ge -> Import | 74 * Help -> Find Action -> "Code Style" (settings) -> Java -> Mana
ge -> Import |
| 75 * Select `third_party/android_platform/development/ide/intellij/codestyl
es/AndroidStyle.xml` | 75 * Select `third_party/android_platform/development/ide/intellij/codestyl
es/AndroidStyle.xml` |
| 76 * Turn on automatic import: | 76 * Turn on automatic import: |
| 77 * Help -> Find Action -> "Auto Import" | 77 * Help -> Find Action -> "Auto Import" |
| 78 * Tick all the boxes under "Java" and change the dropdown to "All". | 78 * Tick all the boxes under "Java" and change the dropdown to "All". |
| 79 * Turn on documentation on mouse hover: |
| 80 * Help -> Find Action -> "Show quick documentation on mouse move" |
| 81 * Turn on line numbers: |
| 82 * Help -> Find Action -> "Show line numbers" |
| 79 | 83 |
| 80 ### Useful Shortcuts | 84 ### Useful Shortcuts |
| 81 | 85 |
| 82 * `Shift - Shift`: Search to open file or perform IDE action | 86 * `Shift - Shift`: Search to open file or perform IDE action |
| 83 * `Ctrl + N`: Jump to class | 87 * `Ctrl + N`: Jump to class |
| 84 * `Ctrl + Shift + T`: Jump to test | 88 * `Ctrl + Shift + T`: Jump to test |
| 85 * `Ctrl + Shift + N`: Jump to file | 89 * `Ctrl + Shift + N`: Jump to file |
| 86 * `Ctrl + F12`: Jump to method | 90 * `Ctrl + F12`: Jump to method |
| 87 * `Ctrl + G`: Jump to line | 91 * `Ctrl + G`: Jump to line |
| 88 * `Shift + F6`: Rename variable | 92 * `Shift + F6`: Rename variable |
| (...skipping 22 matching lines...) Expand all Loading... |
| 111 * Basic Java editing and compiling works. | 115 * Basic Java editing and compiling works. |
| 112 | 116 |
| 113 ### What doesn't work (yet) ([crbug](https://bugs.chromium.org/p/chromium/issues
/detail?id=620034)) | 117 ### What doesn't work (yet) ([crbug](https://bugs.chromium.org/p/chromium/issues
/detail?id=620034)) |
| 114 | 118 |
| 115 * Better support for instrumentation tests (they are treated as non-test .apks r
ight now) | 119 * Better support for instrumentation tests (they are treated as non-test .apks r
ight now) |
| 116 * Make gradle aware of resources and assets | 120 * Make gradle aware of resources and assets |
| 117 * Make gradle aware of native code via pointing it at the location of our .so | 121 * Make gradle aware of native code via pointing it at the location of our .so |
| 118 * Add a mode in which gradle is responsible for generating `R.java` | 122 * Add a mode in which gradle is responsible for generating `R.java` |
| 119 * Add support for native code editing | 123 * Add support for native code editing |
| 120 * Make the "Make Project" button work correctly | 124 * Make the "Make Project" button work correctly |
| OLD | NEW |