keyboard_arrow_left Back to the overview

How to import the sources to Android Studio / IntelliJ

Install Android Studio

Go to the Download page and download the package for your OS.

Unpack the downloaded file to a destination of your choice, then follow the instructions described in Install-Linux-tar.txt file which is in the extracted folder.

Prepare a project file

Open a shell and navigate to the root folder of your Android sources, e.g. ~/android/pe. In case environment functions and variables are not yet loaded, type:

source build/envsetup.sh

Now execute:

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

In case you are developing on multiple branches or plan to do so (otherwise skip the next step), do the following (replace every occurrence of XPerience with your desired naming scheme):

mv android.ipr XPerience.ipr
mv android.iml XPerience.iml && ln -s XPerience.iml android.iml

Prepare Android Studio

Android Studio struggles to parse the huge XPerience / Android sources and requires some different settings than the defaults. Therefore, before starting actual development, it is necessary to change some of those.

Configure memory

Open Android Studio and click on Configure.

Then click on “Edit Custom VM Options” and include the following:

-Xms748m
-Xmx748m

This will set the initial allocated (Xms parameter) and maximum usable (Xmx parameter) RAM to 748MB each. You can also use higher numbers but should not go below that to ensure usability. You can find more information of these and other parameters in the official documentation

Increase the file parsing limit

Again, click on Configure and then click on “Edit Custom Properties” and put idea.max.intellisense.filesize=5000 there (you can change its value to something higher than 5000, if you wish)

This is required so Android Studio can parse very large files to properly provide the auto-complete features (Android Studio calls this IntelliSense).

Start working with Android Studio

Reopen Android Studio and click on Open existing project.

Then navigate to your Android source directory and open the .ipr file.

Configure the project

After opening the project, navigate to File -> Project Structure -> SDKs (this might be disabled until the indexing has finished) and set up a JDK where you remove all libraries (.jar files).

Then, on the left side of the settings panel, choose Project Settings -> Modules and mark the folder out/target/common/R as Sources (you can also select it and press [ALT]+[S]).

Press Apply and close the settings.

Start developing

Now, after all the previous steps are done, you can actually start developing and exploring the sources. The Find in path function (Edit -> Find -> Find in path) can be a good start to find a file you want to modify. Just search for a known string among all source files and then dive in deeper until you actually found the function you want to modify.

Contribute!

After you have modified the sources and tested your change, you can contribute to XPerience by submitting your work.