两种编译Android程序的方法


1、第1种方法


strom@strom-virtual-machine:~/android/Android4.4/development$ mkdir hello


--在android源码目录的development下创建hello目录用来存放C的代码


strom@strom-virtual-machine:~/android/Android4.4/development/hello# vim hello.c


---创建hello.c源码


#include <stdio.h>
int main()
{
printf("Hello World!\n"); //输出 Hello World
return 0;
}


strom@strom-virtual-machine:~/android/Android4.4/development/hello# chmod +x hello.c


--编写一个Android.mk文件


strom@strom-virtual-machine:~/android/Android4.4/development/hello# vim Android.mk


LOCAL_PATH:= $(call my-dir) //本地环境变量
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= hello.c //用来指定源文件


LOCAL_MODULE := helloworld //编译的模块的名字
include $(BUILD_EXECUTABLE) //编译一个动态可用的文件




--开始编译


strom@strom-virtual-machine:~/android/Android4.4# make helloworld


--提示编译成功


Install: out/target/product/generic/system/bin/helloworld




2、第2种方法


通过make helloworld showcommands 命令进行编译





更多相关文章

  1. Windows平台上编译OpenCV的Android版本
  2. android 可执行程序终于可以在nxp8473--cortex-a9平台运行
  3. android studio 3.1.1 创建项目编译不过的问题解决
  4. 64位Ubuntu Kylin14编译android内核
  5. android studio ndk开发遇到的问题
  6. Android(安卓)开发源码分享
  7. eclipse导入android的app
  8. Android基础知识总结(转载)
  9. android编译错误

随机推荐

  1. Android中的Selector
  2. Android——EditText【输入框】的所有属
  3. 去除listView和recyclerview滑动到顶部和
  4. 让Ubuntu和Android同时运行(Ubuntu on And
  5. Android自动朗读(TTS)的实现
  6. android 下编译c++项目
  7. android shape的使用
  8. Android中EditText的inputType属性值
  9. Android(安卓)XML布局报错:android/view/V
  10. TextView属性大全