Setting up Intellij with CyanogenMod/AOSP development

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.

JDK 1.6 no libraries

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.

JDK 1.6 no libraries

Lastly, go to the Sources tab and browse to out/target/common/R. Right click on it and click Source. Apply.

JDK 1.6 no libraries

Synchronize the project. Now you're done! Have fun hacking Android with IntelliJ.

JDK 1.6 no libraries


原文地址: https://shuhaowu.com/blog/setting_up_intellij_with_aosp_development.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值