cd android4.0
mkdir external/hello
cd external/hello
vi hello.c Android.mk
cd ../..
Android.mk文件:
LOCAL_PATH :=$(call my-dir)
$(info $(my-dir))
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS :=optional
LOCAL_SRC_FILES := $(call all-subdir-c-files)
#LOCAL_SRC_FILES := hello.c
LOCAL_MODULE := hello
#LOCAL_SRC_FILES := $(call all-subdir-c-fiies)
include $(BUILD_EXECUTABLE)
hello.c文件:
#include <stdio.h>
int main()
{
printf("hello world!\n") ;
return 0 ;
}
编译如下:
mmm ./external/hello
adb上传
adb push out/target/product/generic/system/bin/hello /data
进入adb shell
adb shell
cd data
./hello