Recently, I discovered a way to import the CyanogenMod source into Intellij. Since the documentation in this area is severely lacking, I thought I might share my experience. There are several things that I have yet to figure out, but the basic setup can be done in Intellij fairly simply (write code, browse code with CTRL+Click).
First, let's assume that you have successfully cloned the CyanogenMod/AOSP repository and built a version of android. The AOSP documentation for IDE development only documents Eclipse and it is fairly out of date. Google included a largely unupdated tool something called idegen under development/tools. However, it does generate correct mostly correct IntelliJ configurations.
Before getting started, you first need to make sure that your IDE have lots of RAM allocated to it. You can modify the file idea.vmoptions and idea64.vmoptions and add these:
-Xms748m
-Xmx748m
Next, you need to open up idea.properties and change idea.max.intellisense.filesize to something like 5000 or more. If we don't do this IntelliJ won't parse some R.java files generated.
Note: these files are located in the IntelliJ/install/location/bin
Now go to your android root directory. Let's assume that the android root directory is ~/cm.
$ cd ~/cm
Compile the idegen tools:
$ cd development/tools/idegen
$ mm
Go back to the root directory and run the tool:
$ cd ~/cm
$ development/tools/idegen/idegen.sh
Go to IntelliJ, and setup an Oracle Java 6 SDK with no libraries. That's right, remove all of the jars from the "Classpath" tab.
At this point you can open up the android.ipr file generated in the android root directory with IntelliJ and you should have AOSP imported! However, we're not done as there is some setup that needs to be fixed:
Go to File -> Project Structure. Remove all of the dependencies that ends with a .jar. This should leave you with only and the 1.6 sdk with no libraries.
Lastly, go to the Sources tab and browse to out/target/common/R. Right click on it and click Source. Apply.
Synchronize the project. Now you're done! Have fun hacking Android with IntelliJ.
原文地址: https://shuhaowu.com/blog/setting_up_intellij_with_aosp_development.html
本文介绍如何在IntelliJ中配置并导入CyanogenMod/AOSP源代码进行开发。主要内容包括分配足够的RAM给IntelliJ、调整解析文件大小限制、使用idegen工具生成配置文件、设置Oracle Java 6 SDK等步骤。





被折叠的 条评论
为什么被折叠?



