AOSP Setup
Hardware Requirements :
64-bit environment
250GB + 150GB disk space
16GB RAM minimum (64GB recommended by Google)
Software Requirements :
Ubuntu 18.04 LTS
For detailed information, Refer Android Docs
Install Required Packages
For detailed information, Refer Android Docs
Install Source Control Tool
Working with Android code requires using both Git (an open-source version-control system) and Repo (a Google-built repository-management tool that runs on top of Git).
For detailed information, Refer Android Docs
Download the Source
Initializing a Repo client
Downloading the Android source tree
For detailed information, Refer Android Docs
Building Android
Setting up the environment
Initialize the environment with the envsetup.sh script:
Choosing a target
Choose which target to build with lunch.
Building the code
Build everything with m.
Running the Build
You can either run your build on an emulator or flash it on a device.
Because you've already selected your build target with lunch, it's unlikely to run on a different target than it was built for.
Flashing with fastboot: To flash a device, use fastboot, which should be included in your path after a successful build.
Emulating an Android device: The emulator is added to your path automatically by the build process. To run the emulator, type:
For detailed information, Refer Android Docs