运行模拟器
emulator -console


* 将文件写入到模拟器的userdata.img文件中
adb push


*将一个目录拷贝到模拟器中,包括子目录
adb push


* 将一个目录从模拟器中拷出来
adb pull


* 使得模拟器可以运行arm代码.
使用GNU/ARM Linux编译器编译你的应用程序就可以了

* 在模拟器里面运行shell,需要先运行模拟器
adb shell


*运行模拟器中的一个控制台程序
adb shell


*连接模拟器的控制台
telnet localhost 5554/6/8


运行C程序


参考文献


Native C "Hello World" working in emulator
[url=http://groups.google.com/group/android-developers/browse_thread/threa...][color=#0000ff]http://groups.google.com/group/a ... wse_thread/threa...[/color][/url]


Native C Applications for Android
[url=http://benno.id.au/blog/2007/11/13/android-native-apps][color=#0000ff]http://benno.id.au/blog/2007/11/13/android-native-apps[/color][/url]


步骤
* 下载GNU/ARM编译工具
[url=http://www.codesourcery.com/gnu_toolchains/arm/download.html][color=#0000ff]http://www.codesourcery.com/gnu_toolchains/arm/download.html[/color][/url]


* 编写c/c++代码.


* 使用GNU/ARM Linux 工具创建一个应用程序,不使用动态链接库
ex. arm-none-linux-gnueabi-g++.exe -static -o hello HelloAndroid.cpp


* 启动模拟器
$SDK_ROOT/tools/emulator.exe


* 在命令行窗口运行 abd将编译好的hello程序放入模拟器的磁盘
adb push hello /system/sbin/hello


* 让hello文件变成可执行程序,不要使用 chmod ugo+x
adb shell chmod 777 /system/sbin/hello


* 运行hello程序
adb shell
cd /system/sbin/
hello


EXAMPLE HELLO WORLD CODE
//
// HelloAndroid.cpp
//
//


#include
using std::cin;
using std::cout;
using std::endl;


class MyName
{
public:
void getname( void );
void sayhello( void );


private:
char name[ 255 ];



};


void MyName::getname( void )
{
cout << "What is your name? ";
cin >> name;


}


void MyName::sayhello( void )
{
cout << "Welcome " << name << " to the world of Android" << endl;


}


MyName name;

int main( int argc, char *argv[] )
{
name.getname();
name.sayhello();
return 0;
}

更多相关文章

  1. Android特性与系统架构
  2. 详解Android(安卓)视频播放时停止后台运行的方法
  3. Android桌面悬浮清内存app概述
  4. android 1.5 SDK 模拟器无法启动问题 “Failed to find an AVD m
  5. adb命令总结
  6. AndroidManifest.xml设置程序安装的路径
  7. Calabash 快速入门 (Android)
  8. 一些安卓的基本权限 清单配置文件
  9. windows平台react-native 报错:Error EPERM: opration not permit

随机推荐

  1. android studio 提示no android sdk foun
  2. Robotium Recorder的初试
  3. Android各种花式酷炫自定义控件开源库集
  4. 关于RelativeLayout的一点经验
  5. android 4.0 sdk直接下载地址
  6. UI
  7. andoid sys bug 转载
  8. [Android] Android的音频采集
  9. AndroidStudio中jniLibs目录自动生成
  10. Android中自定义属性的使用