Android R sdk_version issues in Android.bp file

Viewed 1949

I have created a new module in vendor partition. When I try to link my module with framework I keep getting this error. I am not able to understand the relation between different variants of sdk_version. "system_server_current" , "current", "core_platform", "module_current" ...

Is there a document which can explain these and resolve below issue ?

wifi-service-pre-jarjar depends on newmodule.

error: frameworks/opt/net/wifi/service/Android.bp:47:1: module "wifi-service-pre-jarjar" variant "android_common": compiles against system server API, but dependency "newmodule" is compiling against private API.Adjust sdk_version: property of the source or target module so that target module is built with the same or smaller API set than the source.

1 Answers

I have wrote a note for it based on Android 8.1, Introduce link_type in AOSP build system. Looks like the Android 11 introduces more link_types.

The sdk_version bases on link_type, and it is used to split dependencies between system and app. If your app uses standard SDK API only, you should set your sdk_version to current or the specific API version. Otherwise, you should set sdk_version to system or other variants based on your used API, or set platform_apis: true directly to let your module uses private API.

If your dependency module uses private API, your module inherits the state that uses private API. This state can passed to your module from your dependency module, or dependency module's dependency module, etc.

You can check Android 11's build system source code to learn more accurate and detailed knowledge about sdk_version.

Related