Could someone show me an example of Android.bp for the Android Studio Native C++ app to compile it in AOSP source? It can be for the 'hello world' auto generated project.
Is there a tool that auto generates it?
Thank you
Could someone show me an example of Android.bp for the Android Studio Native C++ app to compile it in AOSP source? It can be for the 'hello world' auto generated project.
Is there a tool that auto generates it?
Thank you
On
There are tons of examples in AOSP source at https://android.googlesource.com of C++ app bp build files.
Here is one particular example I found by searching for "cc_binary "
You can see how that example might be boiled down to hello world simplicity and end up looking like:
cc_binary {
name: "hello_world",
srcs: [
"src/main.cc",
],
cflags: [
"-DEXAMPLE",
],
}
I am not aware of a tool that generates bp files from some other type of build file at this time. On the other hand there is a tool that can take an Android.bp and create a CMake compatible build from it for the purposes of use in CLion, see https://android.googlesource.com/platform/build/soong/+/HEAD/docs/clion.md
More docs on soong bp files can be found at https://source.android.com/docs/setup/build and https://android.googlesource.com/platform/build/soong/+/refs/heads/master/README.md
I am not sure if this is the best approach but I have created an AIDL inteface to bind Java and C++, and then compilated the java code as a
android_app, the AIDL part asjava_library_staticand the C++ code ascc_library_sharedin Android.bp file.Here is the full code: https://github.com/alvenan/aosp_bench/tree/main/bench_test_jni/JavaNativeTestApp
My only issue is that the app is looking for the shared library in
system/lib64while the compilation is sending the .so tovendor/lib64, but if I copy to system, all works fine.