您的位置:首页 > 产品设计 > 产品经理

Setting up Intellij with CyanogenMod/AOSP development

2016-04-09 09:30 543 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: