Android OS Tips
* to start emulator
./emulator -console
* to xfer a file to emulator; this is stored in emulator's userdata.img file
adb push <file> <dst file>
* to copy a file or a directory recursively to emulator
adb push <source> <destination>
* to copy a file or a directory recursively from emulator
adb pull <source> <destination>
* emulator can run native ARM Linux code.
build your apps using GNU/ARM Linux toolchain and then run in emulator.
* to get a shell on the emulator
adb shell
* to run a console app on Android emulator
adb shell <Linux command>
* to connect to emulator console for specific commands
telnet localhost 5554/6/8
Building and Running a native C++ App on the Android Emulator
References
Native C "Hello World" working in emulator
http://groups.google.com/group/andro...f09cb4dd9687cc
Native C Applications for Android
http://benno.id.au/blog/2007/11/13/android-native-apps
Steps:
* download and install GNU/ARM Linux tool chain
http://www.codesourcery.com/gnu_tool.../download.html
* create C/C++ code. see below for sample code.
* build app without dynamic libraries using GNU/ARM Linux toolchain
ex. arm-none-linux-gnueabi-g++.exe -static -o hello HelloAndroid.cpp
* start emulator in Windows by double clicking on $SDK_ROOT/tools/emulator.exe
* in a Windows Command window, use "adb" to xfer executable to emulator disk
adb push hello /system/sbin/hello
* make your app executable; do not use chmod ugo+x
adb shell chmod 777 /system/sbin/hello
* run your app in a console on the emulator
adb shell
cd /system/sbin/
hello
EXAMPLE C++ CODE:
Code:
//
// HelloAndroid.cpp
//
//
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
class ReVan
{
public:
void getname( void );
void sayhello( void );
private:
char name[ 255 ];
**;
void ReVan::getname( void )
{
cout << "What is your name? ";
cin >> name;
**
void ReVan::sayhello( void )
{
cout << "Welcome " << name << " to the world of Android" << endl;
**
ReVan name;
int main( int argc, char *argv[] )
{
name.getname();
name.sayhello();
return 0;
**