5

I like to view/edit android platform java code using Intellij IDE instead of eclipse.

Is it possible? If yes, any pointers up there on how to do this?

Thanks

videoguy
  • 1,732
  • 2
  • 24
  • 49

2 Answers2

8

From AOSP root folder,

1) First build your target. That will generate whatever java files that need to be generated during aosp build. 2) Create a shadow dir of aosp dir using lndir. Assuming your aosp dir is ~john/work/aosp/ics. Then create ~/john/work/aosp/icsshadow

Cd to icsshadow and invoke "lndir ../ics". That will create symlinks to everything under ics.

3) Now you use icsshadow for all the stuff your IDE needs/generates. If you use ics folder, the aosp build some times fails if the IDE generates any build artifacts.

4) cd to icsshadow directory. Invoke development/tools/idegen/idegen.sh

Wait until it is done.

5) If you want to use IntelliJ, open android.ipr from icsshadow folder. If you want to use Eclipse, import .classpath from icsshadow folder.

For eclipse setup, please check Using eclipse to browse and edit AOSP.

videoguy
  • 1,732
  • 2
  • 24
  • 49
  • What happen if you want to add a file? do you have to add it in the ics and do lndir again? – Pierrew Sep 29 '14 at 16:23
  • 1
    Yes. You have to repeat lndir process. – videoguy Sep 30 '14 at 02:52
  • @videoguy Is there any command or sh file to clean AOSP project from gerenated files for IDE? (If I understand correctly, you says we should not generate necessary files for IDE under original folder. Yea? ) – Dr.jacky Jul 25 '16 at 10:18
  • I don't remember lunch script options. But I believe there is "make clean" equivalent that clears all the generated files under lndir root. – videoguy Jul 31 '16 at 05:37
-3

Well, first you have to install Android studio from here: http://developer.android.com/sdk/installing/studio.html

Then, if you already have a project in Eclipse here is how you export it to Android Studio: http://developer.android.com/sdk/installing/migrate.html

Ivan Skoric
  • 1,200
  • 8
  • 18
  • 1
    That option is for moving eclipse ADT based android projects to Studio. What I am looking for is a way to do this for Android platform sources (frameworks/base, packages directory etc). The java code inside android sources don't use the ant build system that sdk based projects use. – videoguy Jul 09 '13 at 14:23
  • See this thread: http://stackoverflow.com/questions/16626810/can-android-studio-be-used-to-run-standard-java-projects – Ivan Skoric Jul 09 '13 at 14:52
  • 1
    That link is for android sdk based apps as well. Android platfrom sources have a directory development/ide/intellij. Wondering what it is for. When I tried to open project with Intellij Community edition pointing to the above directory, nothing happened. – videoguy Jul 15 '13 at 14:30