Creating an Android executable is easy and straight forward with the Android source. Android is not GNU/Linux and it does not have access to standard glibc functions. Instead, android has its own C runtime called bionic. Your executable has to be linked with the bionic libraries instead of standard glibc.
The Android Build System searches every sub folder for Android.mk and executes it. The macros defined by the Android Build System makes sure that your executable are linked with the right libraries.
Steps for creating the android executable
1. Create a folder for your program in the Android Tree. If you not sure on where to create it put it under system folder.
2. Create a basic Android.mk file with the below contents.
The Android Build System searches every sub folder for Android.mk and executes it. The macros defined by the Android Build System makes sure that your executable are linked with the right libraries.
Steps for creating the android executable
1. Create a folder for your program in the Android Tree. If you not sure on where to create it put it under system folder.
2. Create a basic Android.mk file with the below contents.
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
my_program.c \
my_program_1.c
LOCAL_SHARED_LIBRARIES := \
libcutils \
liblog
LOCAL_MODULE:= myprogram
include $(BUILD_EXECUTABLE)
3. Add you program's C files in the macro LOCAL_SRC_FILES.
4. Build and Flash the Android Source.
You should see your program "myprogram" under /system/bin folder.
You can launch you program using the Terminal Emulator application inside the Android Device OR connect the device with adb and execute from the adb shell.
댓글 없음:
댓글 쓰기