Building the Android Open Source Project
Working on the Android platform is a task addressed by Google and OEMs mostly. In this tutorial, you’ll get insights into building the AOSP. By Antonio Roa-Valverde.
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Contents
Building the Android Open Source Project
20 mins
- Getting Started
- Setting up the Development Environment
- Configuring the Ubuntu Container
- Starting the Ubuntu Container
- Updating the Container and Installing Packages
- Using the Repo Tool
- Getting the Sources
- Initializing the Source Folder
- Downloading the Source
- Building the AOSP
- Running the Build
- Setting up the Android Bootloader Animation
- Looking at the Boot Animation Format
- Understanding the Components
- Customizing the Boot Animation
- Where to Go From Here?
Customizing the Boot Animation
To change the boot animation in your AOSP build, you need to use the same target you selected earlier in the lunch
menu: aosp_x86_64-eng.
Open aosp_x86_64.mk from /home/aosp/source/build/make/target/product. At the bottom of the file, add the following lines:
# Boot animation
PRODUCT_COPY_FILES += \
device/generic/x86_64/bootanimation.zip:system/media/bootanimation.zip
This tells the build process to copy your animation file to system/media/bootanimation.zip. This is one of the paths where the boot loader will look for a bootanimation.zip file, as described earlier.
Then, copy bootanimation.zip into /home/aosp/source/device/generic/x86_64/.
In aosp_x86_64.mk, find the line starting with PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST
, then add system/media/bootanimation.zip \ after the last \.
Without this, the build process won’t allow you to copy the ZIP file to system/media. The resulting code should look like this:
PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
root/init.zygote32_64.rc \
root/init.zygote64_32.rc \
system/media/bootanimation.zip \
Finally, save the file and execute the m
command to create a new build with the changes. Don’t worry, the build will take only a few minutes — no tea this time! :]
Once the build is done, open the emulator by running emulator
in your terminal. Tadaaa! Your emulator shows now your custom animation while booting.
To avoid this situation, the recommended alternative is to create your own product. Your challenge is to create the necessary configuration files and add your product as a new entry to the lunch
menu.
Check out the Google documentation for building a product for more information.
Congratulations! You just built your very own Android version. Be proud, this is a quest not everyone has accomplished!
Where to Go From Here?
Download the final project using the Download Materials button at the top or bottom of this tutorial.
In this tutorial, you set up your development environment to build AOSP and you added a small customization by replacing the boot animation. You could now try to design your own animation and include it in your build. Surprise us with your design skills!
What you covered here is just the beginning of the AOSP adventure. There’s a lot to learn when it comes to Android platform development. Check out the official AOSP documentation for more information.
If you’re interested in navigating the AOSP source tree online, use the Android code search tool. This will help you get to know the source tree.
Hopefully, this tutorial supported you in your first steps with AOSP. If you have any questions about what you covered or if you want to show off your own Android customization, please join the discussion below!