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

安卓中添加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 

资源下载

  • 开包即用

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值