I am using Android-O, and I see most of the .mk files are being replaced by .bp file. Now I have modified one of the source code under hardware/interfaces which is built using .bp files.
Now i have a prebuilt shared library that is used by the source code.
But I have not able to figure out how to include prebuilt library into Android.bp file.
Any help/comments will be really appreciated.
After some struggle here I found the solution
1) There is a tool called androidmk to generate Android.bp file out of Android.mk file
Use below commands to build androidmk tool
source build/envsetup.sh
m -j blueprint_tools
Output Path: out/soong/host/linux-x86/bin/androidmk (depending on your host)
Write normal Android.mk file for prebuilt library like this
include $(CLEAR_VARS)
LOCAL_MODULE := newlib
LOCAL_SRC_FILES := newlib.so
LOCAL_MODULE_SUFFIX := .so
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
LOCAL_MODULE_TAGS := optional
include $(BUILD_PREBUILT)
Now run below command androidmk Android.mk > Android.bp
Android.bp file will be created as below
cc_prebuilt_library_shared {
name: "newlib",
srcs: ["newlib.so"],
//ANDROIDMK TRANSLATION ERROR: unspported assignment to LOCAL_MODULE_PATH
//LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARY)
}
2) Now using above Android.bp file I got below error
**out/target/product/mytest/symbols/system/lib64/newlib.so: no symbols**
So I added this
strip: {
none:true,
}
3) Now with new Android.bp I still got this error
**error: newlib.so incompatible target**
So I added this (created 2 directories lib and lib64 with corresponding libraries)
target: {
android_arm: {
srcs: ["lib/newlib.so"],
},
android_arm64: {
srcs: ["lib64/newlib.so"],
}
},
So finally with below Android.bp file my requirement got satisfied
cc_prebuilt_library_shared {
name: "newlib",
target: {
android_arm: {
srcs: ["lib/newlib.so"],
},
android_arm64: {
srcs: ["lib64/newlib.so"],
},
},
strip: {
none:true,
},
}