全部博文(2005)
分类: LINUX
2008-08-01 11:24:54
adb push host文件 emulator目地路径
adb shell 登录emulator
adb logcat捕捉emulator的log
adb shell之后也可运行logcat
adb kill-server 将pc上的server干掉
adb start-server 将pc上的server重启,这样adb新的设置就ok了.
adb shell
adb和emulator等工具在Android的SDK的tool目录下:
android-sdk_m5-rc15_linux-x86/tools
|-- NOTICE
|-- aapt
|-- activityCreator.py
|-- adb
|-- aidl
|-- ddms
|-- dmtracedump
|-- dx
|-- emulator
|-- emulator_orig
|-- lib
|-- mksdcard
|-- sqlite3
`-- traceview
http://benno.id.au/blog/2007/11/13/android-native-apps
ANDROID 技巧
运行模拟器
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
… wse_thread/threa…
Native C Applications for Android
http://benno.id.au/blog/2007/11/13/android-native-apps
步骤
* 下载GNU/ARM编译工具
* 编写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;
}
==============================================
Android Debug Bridge version 1.0.17
-d
-p
a relative/absolute path to a product
out directory like
'out/target/product/sooner'.
If -p is not specified, the
ANDROID_PRODUCT_OUT
environment variable is used, which
must
be an absolute path.
devices - list all connected devices
device commands:
adb update DATAOPTS
If file is not passed, update.zip is
used.
adb push
adb pull
adb sync [
(see 'adb help all')
adb shell - run remote shell interactively
adb shell
adb logcat [
adb forward
forward specs are one of:
tcp:
local:
dev:
adb install
adb bugreport - return all information from the device
that should be included in a bug
report.
adb help - show this help message
adb version - show version num
DATAOPTS:
(no option) - don't touch the data partition
-w - wipe the data partition
-d - flash the data partition
bootloader commands:
adb flashall DATAOPTS - reflash the device from the build
output tree
adb flash [
adb send
adb debug - listen to bootloader debuglog
adb bl
scripting:
adb wait-for-bootloader - block until bootloader is online
adb wait-for-device - block until device is online
adb start-server - ensure that there is a server running
adb kill-server - kill the server if it is running
adb get-state - prints: offline | bootloader | device
adb get-product - prints:
adb get-serialno - prints:
networking:
adb ppp
Note: you should not automatically start a PDP connection.
[parameters] - Eg. defaultroute debug dump local notty usepeerdns
adb sync notes: adb sync [
- If it not specified, both /system and /data partitions will be
updated.
- If it is "system" or "data", only the corresponding partition
is updated.
- If it is a path to a local directory, the name is examined to see if
it points to a directory named ".../system" or ".../data", or if
the directory contains subdirectories with those names. If so, it
pushes
the appropriate directory/ies to the device.
- If the name of the local directory does not match ".../system" or
".../data", it is treated like an "system" directory.
- If