Android使用SDK方法詳解
Android 手機(jī)操作系統(tǒng)可以在模擬器中進(jìn)行一些特定的修改以此滿足用戶的各種需求。那么如何能在模擬器中正確的應(yīng)用Android使用SDK呢?我們將會在這里對這一應(yīng)用技巧進(jìn)行一個詳細(xì)的介紹。
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
【編輯推薦】