1.下載ARM C++交叉編譯器 http://www.codesourcery.com/gnu_toolchains/arm/portal/subscription3057
2.編寫本地C++代碼,如Hello Wolrd,可以使用標準庫STL。編譯的命令行如下
arm-none-linux-gnueabi-g++.exe -static -o android123 android123.cpp
首先運行arm-none-linux-gnueabi-g++.exe程序-static 參數代表靜態庫,-o爲輸出名稱android123,最後的android123.cpp爲源代碼。
3.運行模擬器,用cmd在sdkTools目錄夏之星 adb push android123 /system/sbin/android123
4.設置訪問權限,通過Linux的Shell,在cmd下設置所有用戶完全控制權限adb shell chmod 777 /system/sbin/android123
5.執行這個android123程序,輸入adb shell cd /system/sbin/android123即可。