I am an Android Firmware developer, working with a source of Android 12. I wanted to convert my Android.mk file to Android.bp, with the same definitions in tact in order to build a static jar library.
Android.mk file:
LOCAL_PATH := $(call my-dir)
# the library
# ============================================================
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, src/com/example/foo/player)
# This is the target being built.
LOCAL_MODULE := com.example.foo.player
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
LOCAL_MODULE_TAGS := optional
LOCAL_JACK_ENABLED := disabled
#If Android P, set LOCAL_PRIVATE_PLATFORM_APIS true.
#LOCAL_PRIVATE_PLATFORM_APIS := true
include $(BUILD_STATIC_JAVA_LIBRARY)
Any help is very much appreciated. Thanks in advance.
I have translated the definitions from Android.mk to Android.bp.
It looks like this:
// Android.bp
// Define the module type
java_library_static {
name: "com.example.foo.player",
srcs: [
"src/com/example/foo/player/**/*.java",
],
optional: true,
proguard_flags: "proguard.flags",
//jack_enabled: false, //Jack is deprecated in Android P, use the default value
//private_platform_api: true, // Uncomment this if using Android P
}
Let me know if any corrections or improvisations is necessary.