Android SDK 使用技巧

1. 在Android模拟器上安装和卸载APK包

adb install [-l] [-r] <file> - push this package file to the device and install it
('-l' means forward-lock the app)
  ('-r' means reinstall the app, keeping its data)


adb uninstall [-k] <package> - remove this app package from the device
('-k' means keep the data and cache directories)


安装:

adb install filename.apk

D:/android-sdk/tools>adb install filename.apk
* daemon not running. starting it now *
* daemon started successfully *
347 KB/s (111196 bytes in 0.312s)
        pkg: /data/local/tmp/filename.apk
Success

卸载:

adb uninstall filename.apk

或者

adb shell rm data/app/filename.apk


2. 在Android模拟器上使用sd card

生成sdcard镜像文件:

mksdcard: create a blank FAT32 image to be used with the Android emulator
usage: mksdcard [-l label] <size> <file>

  if <size> is a simple integer, it specifies a size in bytes
  if <size> is an integer followed by 'K', it specifies a size in KiB
  if <size> is an integer followed by 'M', it specifies a size in MiB

D:/android-sdk/tools>mksdcard.exe -l sdcard 2048M sdcard.img


启动模拟器:emulator -sdcard sdcard镜像文件
例如: emulator -sdcard sdcard.img

 

将资源放入到sdcard里面: adb push source-file /sdcard

例如:

D:/android-sdk/tools>adb push NOTICE.txt /sdcard
1088 KB/s (156733 bytes in 0.140s)


使用命令adb shell 查看sdcard目录:
D:/android-sdk/tools>adb shell
# ls sdcard
NOTICE.txt


3. telnet

telnet localhost 5554

 

[lane@localhost base]$ telnet localhost 5554
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Android Console: type 'help' for a list of commands
OK
help
Android console command help:

    help|h|?         print a list of commands
    event            simulate hardware events
    geo              Geo-location commands
    gsm              GSM related commands
    kill             kill the emulator instance
    network          manage network settings
    power            power related commands
    quit|exit        quit control session
    redir            manage port redirections
    sms              SMS related commands
    avd              manager virtual device state
    window           manage emulator window

try 'help <command>' for command-specific help
OK

 

模拟来电

gsm
allows you to change GSM-related settings, or to make a new inbound phone call


available sub-commands:
    list             list current phone calls
    call              create inbound phone call
    busy             close waiting outbound call as busy
    hold             change the state of an oubtound call to 'held'
    accept           change the state of an outbound call to 'active'
    cancel           disconnect an inbound or outbound phone call
    data             modify data connection state
    voice            modify voice connection state
    status           display GSM status

KO: missing sub-command
gsm call 112
OK

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值