How to import the sources to Android Studio / IntelliJBack to the overview
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.
In case environment functions and variables are not yet loaded, type:
croot(go to your Android root dir) and see if it gives an error. If not, you have already executed the
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
lineage with your desired naming scheme):
mv android.ipr lineage.ipr mv android.iml lineage.iml && ln -s lineage.iml android.iml
Prepare Android Studio
Android Studio struggles to parse the huge LineageOS / Android sources and requires some different settings than the defaults. Therefore, before starting actual development, it is necessary to change some of those.
Open Android Studio and click on Configure.
Then click on “Edit Custom VM Options” and include the following:
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 usablility. 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
Start working with Android Studio
Reopen Android Studio and click on Open existing project.
Then navigate to your Android source directory and open the
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 (version 1.8 for LineageOS 14.1 branch) where you remove all libraries (
Then, on the left side of the settings panel, choose Project Settings -> Modules and mark the folder
Sources (you can also select it and press [ALT]+[S]).
Press Apply and close the settings.
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.
After you have modified the sources and tested your change, you can contribute to LineageOS by submitting your work.