Android内核开发 adb安装apk软件包等命令

adb命令连接好设备后,上传apk软件包并自动安装

[hadoop@localhost platform-tools]$ ./adb install AndroidTest-a17-WordCount.apk 
612 KB/s (248756 bytes in 0.396s)
pkg: /data/local/tmp/AndroidTest-a17-WordCount.apk
Success


20171024补:

截图

adb shell /system/bin/screencap -p /sdcard/screenshot.png(保存到SDCard)
adb pull /sdcard/screenshot.png d:/screenshot.png(保存到电脑)

20170905补:

查看已连接设备
F:\ProgramFiles\Android\sdk0\platform-tools>adb devices
List of devices attached
192.168.1.109:5555      device

进入和退出shell环境

F:\ProgramFiles\Android\sdk0\platform-tools>adb shell
rpi3:/ $
130|rpi3:/ $ exit


查看已安装app

rpi3:/ $ pm list packages
package:com.android.cts.priv.ctsshim
package:com.android.providers.telephony
package:com.android.providers.calendar
package:com.android.providers.media

找到apk文件位置

rpi3:/ $ pm path org.appspot.apprtc
package:/data/app/org.appspot.apprtc-I67CEwYMa2-6bOS_PPSZFQ==/base.apk
rpi3:/ $

取出文件,将apk文件取出放到当前目录下

F:\ProgramFiles\Android\sdk0\platform-tools>adb pull /data/app/org.appspot.apprt
c-I67CEwYMa2-6bOS_PPSZFQ==/base.apk ./
/data/app/org.appspot.apprtc-I67CEwYMa...d. 4.0 MB/s (17812476 bytes in 4.220s)

卸载app

F:\ProgramFiles\Android\sdk0\platform-tools>adb uninstall org.appspot.apprtc
Success


查看当前活动Activity

F:\ProgramFiles\Android\sdk0\platform-tools>adb shell "dumpsys window | grep mCurrentFocus"
  mCurrentFocus=Window{39c8d06 u0 com.android.iotlauncher/com.android.iotlaunche
r.IoTLauncher}
注意要加上双引号

关闭某应用

adb shell am force-stop <package-name>


启动某应用

adb shell am start <package-name>/.ActivityName


查看apk入口等信息

aapt.exe dump badging test.apk >>apkinfo.txt

更多请参考http://www.jianshu.com/p/5980c8c282ef




posted @ 2016-10-19 00:52  Leytton  阅读(518)  评论(0编辑  收藏  举报