Android Device Monitor篇
1 找不到外置存储卡根目录?
Q:在应用程序中通过Environment.getExternalStorageDirectory().getAbsolutePath()获得外置存储卡根目录是/storage/emulated/0,可是File Explorer中却看不到这一路径,怎么办?
A:打开Windows的cmd窗口,进入Android SDK 的platform-tools文件夹下,运行adb root
再次查看File Explorer,即可查看并进入/storage/emulated/0文件夹
2 如果多个模拟器设备同时运行,如何选择?
Q:当前环境下同时运行了两个模拟器设备,如何选择进入某个设备?
A:首先,运行adb devices查看当前的模拟器设备
其次,通过-s选项指定要进入的模拟器设备
目标设备选择
Q:点击运行后,Select Deployment Target界面上未显示任何设备?
A:这一问题可能是adb默认的5037端口被占用导致的。您可能会看到弹出窗口错误
在Event log窗口中您也会看到类似信息:
error: could not install smartsocket listener: cannot bind to 127.0.0.1:5037: 通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 (10048)
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application’s support team for more information.
could not read ok from ADB Server
* failed to start daemon *
error: cannot connect to daemon
‘E:\android\sdk\platform-tools\adb.exe start-server’ failed – run manually if necessary
首先,在Windows的cmd窗口中运行如下命令
netstat -aon|findstr "5037"
其次,打开Windows的任务管理器,查看列出的进程ID
第三,尝试结束这一进程,或由于这一进程对应的应用就是360手机助手,也可直接关闭360手机助手
第四,再次点击运行,在Select Deployment Target界面上即可看到所有的模拟机设备和手机平板设备
备注:小编在这里栽了一个大大的跟头,花费了很多时间才发现原来是由于360手机助手占用了Android adb的默认端口号。要知道,360手机助手一直是小编的最爱啊。。