Can we use Android studio for AOSP development?

28,959

Solution 1

You can use Android Studio as a IDE for AOSP, since it's just a modified version of InteliJ's IDE.

from AOSP root:

 make idegen && development/tools/idegen/idegen.sh

Then just "Open Project" in Android Studio and select the android.ipr it generated.

Solution 2

To import AOSP source in Android Studio or Eclipse, follow the full instructions here : https://android.googlesource.com/platform/development/+/master/tools/idegen/README

Solution 3

What Pedlar suggested above is one way of doing it. I ran into lot of Jar dependency issues when I tried it with IDEA community edition (Android Studio is a fork of IDEA IDE). The IDE keeps prompting you about duplicate jars etc. The generated project includes framework Java sources as well as App sources. I tried to build an App project which resulted in broken AOSP build. IMHO, IDEA is a great IDE for Java development. But didn't work well with AOSP.

What worked for me is using eclipse to browse/edit/debug framework sources, but build the code from a terminal window. To avoid AOSP build breaks, please create a shadow dir of AOSP (i.e. lndir of AOSP) and use shadow dir for eclipse project.

This is explained at Using eclipse to browse/edit AOSP link in step by step. If you are working on AOSP, you might want to check Debugging Android framework services.

Share:
28,959
user755499
Author by

user755499

Updated on January 18, 2020

Comments

  • user755499
    user755499 over 4 years

    Can we use Android studio for AOSP(Android Open Source Project) development, is there a way to do it. I didnt find one. anybody got any idea on this please ?

  • Rosenpin
    Rosenpin over 9 years
    Every time I'm trying to run this code I get java exception Exception in thread "main" java.io.FileNotFoundException: ./out/target/product/hammerhead/obj/GYP/shared_intermediates‌​/res.java (Is a directory)
  • user755499
    user755499 almost 9 years
    Setting up Intellij with CyanogenMod/AOSP development - shuhaowu.com/blog/…
  • Chef Pharaoh
    Chef Pharaoh over 7 years
    @Rosenpin You will need to modify development/tools/idegen/src/Configuation.java at line 135 to ensure the file is not a directory (path.endsWith(".java") && !file.isDirectory()).
  • ruseel
    ruseel over 6 years
    If there is no idegen and if you prefer intellij, try to import project with intellij and 'gradle' for model. That worked for me.
  • Shadow
    Shadow over 4 years
    Then how to generate the apk for individual app?
  • Jian Guo
    Jian Guo almost 3 years
    Update: you need to run source build/envsetup.sh && lunch before run make idegen, as AOSP contains its own buildtools(javac, make etc)