Reputation: 3174
I successfully built LineageOS 21 on my Ubuntu 20.04 machine for the emulator:
cd lineageos
source build/envsetup.sh
breakfast sdk_phone_x86_64
mka
I want to integrate a native C application to the ROM. I did the following steps:
1) Create the native C app "helloworld"
cd lineageos
mkdir -p external/helloworld
nano external/helloworld/helloworld.c
Added the following code to helloworld.c
/* external/helloworld/helloworld.c */
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
2) Create the blueprint file
Create the Android.bp file within the external/helloworld directory:
nano external/helloworld/Android.bp
Added the following content:
cc_binary {
name: "helloworld",
srcs: ["helloworld.c"],
installable: true,
relative_install_path: "bin",
}
And now I am little bit stuck and don't know how and where to add the helloworld app into the build process so that the command mka
builds also my native app and integrates it into the ROM.
I tried the following without success:
3) Modify the emulator prodict makefile
nano device/generic/goldfish/product/generic.mk
Added the following content at the end of the file:
PRODUCT_PACKAGES += helloworld
4) Clean and build
make clean
source build/envsetup.sh
breakfast sdk_phone_x86_64
mka
This results in the following error:
build/make/core/artifact_path_requirements.mk:31: warning: vendor/lineage/build/target/product/lineage_sdk_phone_x86_64.mk produces files inside build/make/target/product/generic_system.mks artifact path requirement.
Offending entries:
system/bin/helloworld
In file included from build/make/core/main.mk:1433:
build/make/core/artifact_path_requirements.mk:31: error: Build failed.
How to make this work? How to correctly integrate the native C helloworld app into the ROM?
Upvotes: 0
Views: 94
Reputation: 411
First of all please note your terminology - you're not integrating a regular Android app but a binary.
Secondly, the warning you get is due to generating intermediates in a wrong path. Please try removing installable & relative_install_path properties from your bp file.
Upvotes: 0