Search code examples
androidandroid-source

how to specify a module only get compiled and installed in userdebug build while not user build


I am developing an Android native service. I want to compile and install it only for userdebug builds. How to specify this? Thanks.

Will adding the package to PRODUCT_PACKAGES_DEBUG work?


Solution

  • You can use PRODUCT_PACKAGES_DEBUG += some_package, which will include some_package in userdebug and eng builds (reference).

    Alternatively, you can add the package directly to PRODUCT_PACKAGES conditionally:

    ifeq ($(TARGET_BUILD_VARIANT),userdebug)
       PRODUCT_PACKAGES += some_package
    endif