Sony is counted among the better contributors to the Android Open Source Project, with a lot of code contributions through the years. Sony also runs and maintains its own Xperia Open Devices program, making it easy for developers to tinker with AOSP on their recent Sony devices. With Android 12 now being released to the public, Sony has added AOSP build instructions for Android 12 to Xperia Open Devices.

Sony releases device trees, kernel trees, binaries, and build instruction to compile AOSP for all the devices in the program. These releases have been happening since a few years now, and the resources have now been updated for Android 12. With these Android 12 compatible binaries and the step-by-step guide to AOSP 12.0 for select Xperia devices, developers and expert users now have the tools to tinker with the latest platform.

Build AOSP Android 12 for Sony Xperia Devices

To get started, you’ll need to have access to a suitable build environment so that you can compile the AOSP build from the source. You should ideally choose a PC running Linux (Sony recommends Ubuntu 18.04 LTS), but Windows 10 users can also do the same using Windows Subsystem for Linux (WSL). The next part is configuring the build environment, i.e., you have to install an appropriate version of Java Development Kit, a handful of software packages and libraries, and the Repo tool to work across multiple repositories. Finally, you need to download the whole Android 12 source code tree, the local manifests for the Xperia devices, and follow step-by-step instructions of the guide to successfully compile AOSP images. If everything goes well, you should have the AOSP 12.0 images ready to be flashed on your Sony smartphone.

Note that you must unlock the bootloader of your Xperia device before flashing the resultant build. Moreover, a platform-specific image containing the low-level software binaries needs to be flashed as the vendor image.