Wednesday, October 26, 2011
Tuesday, October 25, 2011
Monday, October 24, 2011
Android Native C 之 Helloworld的四種編譯方式_StackDoc
Android Native C 之 Helloworld的四種編譯方式_StackDoc
vim helloworld.c
#include
int main()
{
printf("Hello World!\n");
return 0;
}
vim Android.mk
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:=hello.c
LOCAL_MODULE := helloworld
LOCAL_MODULE_TAGS := optional
include $(BUILD_EXECUTABLE)
目錄結構 ─ helloworld
├── jni
├── Android.mk
├── jni
├── Android.mk
└── hello.c
[root@fontlose nativity]# cd hello
[root@fontlose hello]# export NDK_PROJECT_PATH=`pwd`
[root@fontlose hello]# ndk-build
Install : helloworld => libs/armeabi/helloworld
[root@fontlose hello]# adb push libs/armeabi/helloworld /data
44 KB/s (2176 bytes in 0.047s)
[root@fontlose hello]# adb shell
/ # cd /data
/data # ls -l
-rwxrwxrwx root root 2176 2011-08-07 03:01 helloworld
/data # ./helloworld
Hello World!
Note:
我在Linux編完再透過Windos的adb傳 結果helloworld權限跑掉
還好之前有裝busybox ,
[xxx@xxx]#busybox chmod 755 helloworld
Subscribe to:
Posts (Atom)