BluePrint for Application Project

How to configure Android.bp for an application

Here is list of some properties in an android application blueprint:

  • name: The name of the module. This must be unique across all Android.bp files.

  • srcs: A list of the source files that make up the module.

  • manifest: The path to the AndroidManifest.xml file for the module.

  • resource_dirs: A list of directories that contain resources for the module.

  • platform_apis: A boolean value that indicates whether the module uses platform APIs.

  • required: A list of other modules that the module depends on.

  • certificate: The certificate that is used to sign the module.

  • privileged: A boolean value that indicates whether the module has privileged permissions.

  • overrides: A list of other modules that the module overrides.

  • static_libs: A list of static libraries that the module depends on.

  • libs: A list of dynamic libraries that the module depends on.

  • optimize: A property that controls whether the module is optimized.

  • dex_preopt: A property that controls whether the module is pre-optimized for dex.

  • product_variables: A property that allows you to set product-specific variables for the module.

Here is a sample android.bp file

android_app {
    name: "CarLauncher",
    
    srcs: [
        "app/src/main/java/**/*.java"
    ],
    
    manifest: "app/src/main/AndroidManifest.xml",

    resource_dirs: [],

    platform_apis: true,

    required: ["allowed_privapp_com.android.car.carlauncher"],

    certificate: "platform",

    privileged: true,

    overrides: [
        "Launcher2",
        "Launcher3",
        "Launcher3QuickStep",
    ],

    static_libs: ["CarLauncher-core"],

    libs: ["android.car"],

    optimize: {
        enabled: false,
    },

    dex_preopt: {
        enabled: false,
    },

    product_variables: {
        pdk: {
            enabled: false,
        },
    },
}

Last updated