Android.bp include aar shared between apps

66 Views Asked by At

I am working on my custom AOSP and I would like to have several applications sharing the same resources. This means I want to put all the res inside an .aar library and I want to avoid that all the resources are copied inside all the apps apks in order to avoid overhead in all the apps. So the aar should behave similarly to a dynamic library but all the attempts I did so far are always replicating che aar content in the apks..

I tried like this:

Android.bp for aar 

    android_library_import {
      name: "CommonUiLibDyn",
      aars: [
        "common_ui_lib.aar"
      ],
      static_libs: [
        "androidx.appcompat_appcompat",
        "com.google.android.material_material",
        "androidx-constraintlayout_constraintlayout"
      ],
        sdk_version: "core_platform",
    }


Android.bp for app

    android_app {
      name: "ResourcesTester_1",
      srcs: ["app/src/*/*.java",],
      resource_dirs: ["app/src/main/res/",],
      manifest: "app/src/main/AndroidManifest.xml",
      static_libs: [
        "CommonUiLibDyn",
        "androidx.appcompat_appcompat",
     "com.google.android.material_material","androidx-constraintlayout_constraintlayout"
      ],
      sdk_version: "",
      platform_apis: true,
    }

Is it anything that can be achieved? I can also build the aar (or any other kind of thing) within AOSP, it' not mandatory to use the pre generated one if it helps.. the only thing I want is avoid to put all the resources duplicate in all of the apps

0

There are 0 best solutions below