〖Android〗把CM(Android)源代码导入eclipse的正确方法(2013-7-3)
1. 首先应当使CM代码成功编译过一次;
cd /path/to/cm . build/envsetup lunch full-eng mka
2. 配置eclipse开发的基本环境
cd /path/to/cm cp development/ide/eclipse/.classpath . chmod u+w .classpath
打开eclipse:
window->preferences->java->Code style->Formatter中导入development/ide/eclipse/android-formatting.xml ,配置eclipse编辑器的代码风格
window->preferences->java->Code style->Organize Imports中导入/development/ide/eclipse/android.importorder,配置eclipse的import的顺序和结构
3. 创建java工程以导入
打开eclipse
- Click the File menu » new » java project
- Give a project name of CyanogenMod
- Uncheck use default location
- Point the location to /path/to/cm
- Keep all other defaults
- Click finish
注:网上有人提示到创建Android Project,或者拷贝项目到workspace神马都是错误的,没有参考价值;
参考来源1:http://source.android.com/source/using-eclipse.html
参考来源2:http://wiki.cyanogenmod.org/w/Doc:_eclipse