AOSP Source Code in Android Studio (Explore only)

Assuming that you are aware of downloading AOSP code and setup ubuntu for machine for the same. If not please go through my previous two chapters.

  1. Setup AOSP on Ubuntu machine
  2. Compile and Build AOSP commands

We have multiple options to open source code in android studio. Depends upon task or need. Considering you are an android developer and just want to explore the code then you can open full source code in the android studio. But if you want to make changes in the particular part of source code then some more settings related to Framework SDK setup needed.

Suppose you got a task to add new system service in the framework and you need to open framework code in IDE and also want code completion, IntelliSense and debugging like features that we are familiar with and used to. then we need more efforts to set IDE accordingly and yes it is absolutely possible. We will cover all those aspects in the coming chapters.

This is what the situation in Feb 2020 but hope google will provide more tools for easy development.

1. Open Code In Android Studio for just browsing

  • Assuming that we have downloaded code mentioned in the last chapters and also gone through a few commands to be needed.
  • Before opening the project in android studio set following parameres to avoid an android studio getting stuck or unresponsive.
  • Open studio64.vmoptions file in android studio and put the following two values in it.

-Xms1024m

-Xmx1024m

  • Now let's start with initial environment setup commands. which are necessary for every terminal session.

source build/envsetup.sh

mmm development/tools/idegen/

sudo development/tools/idegen/idegen.sh

After the above three commands, you will observe that in the AOSP folder there are two files android.ipr and android.iml has generated.

Change their access permission so that it will not create a problem further.

sudo chmod 777 android.iml

sudo chmod 777 android.ipr

  • Now open android.ipr file in the android studio using right-click on the file and open with Android studio. or you can open it from android studio.
  • It will take almost half an hour on average computer to load full project because the android studio does indexing of all files.
  • This is how we can open a full AOSP project in the android studio.

For editing and setting up the AOSP source code for framework development, we will go with a detailed set up in the next chapter.

See all my posts here and do connect with me on LinkedIn for your queries.

Software Engineer. (Mobile and Web)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store