The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 1 | IDEGen automatically generates Android IDE configurations for IntelliJ IDEA |
| 2 | and Eclipse. Your IDE should be able to compile everything in a reasonable |
| 3 | amount of time with no errors. |
| 4 | |
| 5 | If you're using IntelliJ... |
| 6 | |
| 7 | If this is your first time using IDEGen... |
| 8 | |
Aurimas Liutikas | f2e4985 | 2017-05-08 17:44:23 -0700 | [diff] [blame] | 9 | Android is large, thus IDEA needs a lot of memory. Add "-Xms1g -Xmx5g" to |
| 10 | your VM options in "Help > Edit Custom VM" and increase the |
| 11 | file size limit in "Help -> Edit custom properties" by adding |
| 12 | "idea.max.intellisense.filesize=100000". Make sure to restart the IDE for |
| 13 | the new settings to take effect. |
The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 14 | |
Aurimas Liutikas | f2e4985 | 2017-05-08 17:44:23 -0700 | [diff] [blame] | 15 | Create a JDK configuration named "1.8 (No Libraries)" by adding a new |
The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 16 | JDK like you normally would and then removing all of the jar entries |
| 17 | under the "Classpath" tab. This will ensure that you only get access to |
| 18 | Android's core libraries and not those from your desktop VM. |
| 19 | |
| 20 | From the project's root directory... |
| 21 | |
| 22 | Repeat these steps after each sync... |
Chiao Cheng | 797198b | 2012-05-31 17:11:22 -0700 | [diff] [blame] | 23 | |
The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 24 | 1) make (to produce generated .java source) |
| 25 | 2) development/tools/idegen/idegen.sh |
| 26 | 3) Open android.ipr in IntelliJ. If you already have the project open, |
| 27 | hit the sync button in IntelliJ, and it will automatically detect the |
| 28 | updated configuration. |
Chiao Cheng | 797198b | 2012-05-31 17:11:22 -0700 | [diff] [blame] | 29 | |
The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 30 | If you get unexpected compilation errors from IntelliJ, try running |
| 31 | "Build -> Rebuild Project". Sometimes IntelliJ gets confused after the |
| 32 | project changes significantly. |
| 33 | |
| 34 | If you're using Eclipse... |
| 35 | |
| 36 | If this is your first time using IDEGen... |
| 37 | |
| 38 | Edit eclipse.ini ("Eclipse.app/Contents/MacOS/eclipse.ini" on OS X) and |
| 39 | add "-Xms748m -Xmx748m" to your VM options. |
| 40 | |
Michael | 6836ddf | 2015-12-06 13:54:56 +0100 | [diff] [blame] | 41 | Configure a JRE named "1.7 (No Libraries)" under "Preferences -> Java -> |
The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 42 | Installed JREs". Remove all of the jar entries underneath "JRE system |
| 43 | libraries". Eclipse will not let you save your configuration unless at |
| 44 | least one jar is present, so include a random jar that won't get in the |
| 45 | way. |
| 46 | |
| 47 | From the project's root directory... |
| 48 | |
| 49 | Repeat these steps after each sync... |
| 50 | |
| 51 | 1) make (to produce generated .java source) |
| 52 | 2) development/tools/idegen/idegen.sh |
| 53 | 3) Import the project root directory into your Eclipse workspace. If you |
| 54 | already have the project open, simply refresh it (F5). |
| 55 | |
| 56 | Excluding source roots and jars |
| 57 | |
Chiao Cheng | 797198b | 2012-05-31 17:11:22 -0700 | [diff] [blame] | 58 | IDEGen keeps an exclusion list in the "excluded-paths" file. This file |
The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 59 | has one regular expression per line that matches paths (relative to the |
| 60 | project root) that should be excluded from the IDE configuration. We |
| 61 | use Java's regular expression parser (see java.util.regex.Parser). |
| 62 | |
| 63 | You can create your own additional exclusion list by creating an |
| 64 | "excluded-paths" file in the project's root directory. For example, you |
| 65 | might exclude all apps except the Browser in your IDE configuration with |
| 66 | this regular expression: "^packages/apps/(?!Browser)". |
Chiao Cheng | 797198b | 2012-05-31 17:11:22 -0700 | [diff] [blame] | 67 | |
The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 68 | Controlling source root ordering (Eclipse) |
| 69 | |
| 70 | You may want some source roots to come before others in Eclipse. Simply |
| 71 | create a file named "path-precedence" in your project's root directory. |
| 72 | Each line in the file is a regular expression that matches a source root |
| 73 | path (relative to the project's root directory). If a given source root's |
| 74 | path matches a regular expression that comes earlier in the file, that |
| 75 | source root will come earlier in the generated configuration. If a source |
| 76 | root doesn't match any of the expressions in the file, it will come last, |
| 77 | so you effectively have an implicit ".*" rule at the end of the file. |
| 78 | |
| 79 | For example, if you want your applications's source root to come first, |
| 80 | you might add an expression like "^packages/apps/MyApp/src$" to the top |
| 81 | of the "path-precedence" file. To make source roots under ./out come last, |
Chiao Cheng | 797198b | 2012-05-31 17:11:22 -0700 | [diff] [blame] | 82 | add "^(?!out/)" (which matches all paths that don't start with "out/"). |