adb链接手机调试android应用
adb链接手机调试android应用
hulk@hulk-Lenovo:~$ adb devices
List of devices attached
????????????
no permissions
//切换到root权限目录下
hulk@hulk-Lenovo:~$ su
密码:
root@hulk-Lenovo:/home/hulk#
//如果没有安装adb,可以到androidsdk目录下/platform-tools目录下,./adb
root@hulk-Lenovo:/home/hulk# adb kill-server
root@hulk-Lenovo:/home/hulk# adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
root@hulk-Lenovo:/home/hulk# adb devices
List of devices attached
16fd092c
offline //没有打开调试模式
root@hulk-Lenovo:/home/hulk# adb devices
List of devices attached
16fd092c
device
例子:
1.首先要连接上手机
zhoulc@zhoulc-PC:~$ su root
Password:
root@zhoulc-PC:/home/zhoulc# adb devices
List of devices attached
???????????? no permissions
root@zhoulc-PC:/home/zhoulc# adb kill-server
root@zhoulc-PC:/home/zhoulc# adb start-server
root@zhoulc-PC:/home/zhoulc# adb devices
List of devices attached
???????????? no permissions
root@zhoulc-PC:/home/zhoulc# adb kill-server
root@zhoulc-PC:/home/zhoulc# adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
root@zhoulc-PC:/home/zhoulc# adb devices
List of devices attached
n880e device
---------------------------------------说明连接上了手机,如果还不行,可以拔掉手机重试------------------------------------
root@zhoulc-PC:/home/zhoulc# exit
exit
zhoulc@zhoulc-PC:~$ adb devices
List of devices attached
n880e device
zhoulc@zhoulc-PC:~$ adb shell
root@android:/ # exit
2.ubuntu开发环境下,adb 安装命令有两种,一个是adb install -r 即把一个软件重新安装到手机设备中去。另一个就是adb push命令,将apk 压到特定的目录下。
使用adb install -r命令安装
zhoulc@zhoulc-PC:~$ adb install -r workspace/out/target/product/generic/system/app/XXX.apk
3650 KB/s (225676 bytes in 0.060s)
pkg: /data/local/tmp/ResManager.apk
Failure [INSTALL_FAILED_DEXOPT]
zhoulc@zhoulc-PC:~$
可以发现安装失败,
下面就用adb push命令试试吧,就是将指定目录下的apk安装到/system/app里
zhoulc@zhoulc-PC:~$ adb push workspace/out/target/product/generic/system/app/XXX.apk /system/app
3672 KB/s (225676 bytes in 0.060s)
zhoulc@zhoulc-PC:~$
观察手机里面已经ok了