> ## Documentation Index
> Fetch the complete documentation index at: https://docs.incredibuild.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Accelerating Android OS Builds (AOSP)

Last updated on Jan 06, 2022

For all supported AOSP versions, except for version 5, Incredibuild Linux provides a customized ib\_profile.xml file, which is designed for each version separately. Before you run an AOSP build, you need to locate the appropriate ib\_profile.xml file for your AOSP version, and copy it to your project directory. Then, you can run your AOSP builds with Make.

## **Executing AOSP 10 and 11 Builds**

Before you execute AOSP 10 and 11 builds, there are certain actions you need to perform in order to prepare your Incredibuild Environment for the executions.

**To prepare your Incredibuild Environment for executing AOSP 10 and 11 builds:**

1. Find and use the predefined ib\_profile.xml file

   1. Locate the ib\_profil.xml file

      ```
      /opt/incredibuild/data/custom_profiles/android/9-11
      ```

   2. Copy this ib\_profil.xml file to your project directory, where the ib\_console \*\*will run.\*\*For example:

      ```
      ~/Android/Project_Directory/ib_profile.xml
      ```

2. If you are using AOSP 11 without any modifications (vanilla), create a batch file to initialize certain environment variables. If you are using a different shell, create a similar file (named m droid in the example below) that is suited to your shell with the following commands:

   ```
   #!/bin/bash
   source build/envsetup.sh
   lunch aosp_arm-eng
   m droid
   ```

You can now execute builds with Incredibuild Linux by running AOSP builds with Incredibuild Linux as follows:

```
ib_console ./m_droid -j < Number_of_Processes_to_Run_in_Parallel>
```

For example:

```
ib_console ./m_droid -j 200
```

### Troubleshooting AOSP 10-11

If you are having issues, verify that the config file sets the size of the shared memory that will be used by the running builds. This setting is sometimes needed for the execution of AOSP 10+ sandbox. Unlike other AOSP versions, AOSP 10 and 11 have a limitation on the size of shared memory that can be used. Therefore, you may need to explicitly set the memory size, and not to use the default size.

1. Go to: /opt/incredibuild/settings/initiatorShmMaxSize.config. If this file does not exist, please create it.

2. Verify that the file includes the number 300. This is the maximum memory size in MB that will be allocated to AOSP 10+ builds.

<Note>
  **Note:**

  * Do NOT enter "**MB**" into the file, only the number of the memory size.

  * Generally, the shared memory size can be between 200 MB and 1 GB. However, it is important to set it to 300 in this case.
</Note>

## **Executing Android 5-9 OS Builds**

**Note**: You can run Android version 5 with the default ib\_profile.xml file.

**To execute Android 5- 9 OS builds:**

1. \[Before the build run – mandatory for all Android versions, except for version 5.] Find and use the predefined ib\_profile.xml file that is appropriate for your Android version:
   1. Locate the appropriate ib\_profile.xml file for your Android version at:

      `/opt/incredibuild/data/custom_profiles/android/<android_version_no.>`

   2. Copy the appropriate ib\_process.xml file to your project directory, where the ib\_console command will run.For example:

      `~/Android/Project_Directory/ib_profile.xml`

2. Run your Android builds with the appropriate parameters:

* **For Android versions 5,6,7,9** - run with your build tool command as follows:

  ```
  ib_console <Your_Build_Tool_Command> -<Multiprocessing_Command> <Number_of_Processes_to_Run_in_Parallel>
  ```

  For example, if your are using Make enter the following:

  ```
  ib_console make –j XX
  ```

* **For Android 8** - run with your build tool command as follows:

  ```
  ib_console <Your_Build_Tool_Command> ANDROID_COMPILE_WITH_JACK:=false -<Multiprocessing_Command> <Number_of_Processes_to_Run_in_Parallel>
  ```

  For example, if your are using Make enter the following:

  ```
  ib_console make ANDROID_COMPILE_WITH_JACK:=false -j XX
  ```

  Where:`**-j**` - the maximum number of processes that Make will execute in parallel.**Note**: It is recommended to enter for the **`-j`** parameter a value that is between the number of all the cores in Incredibuild Environment and the double of this number.
