BluePrint for Android Library Project

How to configure Android.bp for an android library

Here is list of some properties in an android library blueprint

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

  • platform_apis: A boolean property that specifies whether the module is using platform APIs. If this property is set to true, then the module can only be used on devices that have the platform APIs installed.

  • srcs: A list of the source files that are used to build the module. These files can be Java, C++, or resource files.

  • resource_dirs: A list of the directories that contain resources that are used by the module. These directories can contain XML files, layout files, drawable files, and other resource files.

  • static_libs: A list of the static libraries that are linked to the module. These libraries can be used to provide additional functionality to the module.

  • libs: A list of the shared libraries that are linked to the module. These libraries can be used to provide additional functionality to the module.

  • manifest: The path to the AndroidManifest.xml file for the module. This file contains information about the module, such as its permissions and activities.

Here is an example Android.bp file

android_library {
    name: "CarLauncher-core",
    platform_apis: true,

    srcs: ["src/**/*.java"],

    resource_dirs: ["res"],

    static_libs: [
        "androidx-constraintlayout_constraintlayout-solver",
        "androidx-constraintlayout_constraintlayout",
        "androidx.lifecycle_lifecycle-extensions",
        "car-media-common",
        "car-telephony-common",
        "car-ui-lib",
        "WindowManager-Shell",
    ],

    libs: ["android.car"],

    manifest: "AndroidManifest.xml",
}

Last updated