安卓与C代码 (一) 安卓中添加C可执行程序源码

版权声明:本文为博主原创文章,任何组织或者个人可以在任何媒介上发表或转载我的文章、图片等.且转载后必须注明出处和邮箱,博客地址(https://blog.csdn.net/u011011827),本人邮箱([email protected]) https://blog.csdn.net/u011011827/article/details/89706337

安卓中添加C可执行程序源码

frameworks 中 添加 testing 目录
frameworks/testing$ ls -R
.:
Android.mk  hello

./hello:
Android.mk  hello_test.c

$ cat Android.mk 
include $(call all-subdir-makefiles)
$ cat hello/Android.mk 
LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)
LOCAL_SRC_FILES:= hello_test.c
LOCAL_MODULE:= hello_test
LOCAL_32_BIT_ONLY := true

include $(BUILD_EXECUTABLE)
$ cat hello/hello_test.c 
#include <stdio.h>
int main(){
	printf("hello android\n");
	return 0;
}


mm 编译问题
[ 44% 4/9] target thumb C: hello_test <= frameworks/testing/hello/hello_test.c
[100% 9/9] Install: out/target/product/sw960/system/bin/hello_test
#### build completed successfully (03:30 (mm:ss)) ####
权限为 -rwxrwxr-x


全编译没生成 hello_test 文件,如果需要
vendor/qcom/proprietary/common/config/device-vendor.mk
# 需要确认 GPS_DBG 被编译进去
GPS_DBG += hello_test 

资源下载

  • 开包即用

其他,连接库及头文件问题

猜你喜欢

转载自blog.csdn.net/u011011827/article/details/89706337