现在的位置: 首页 > 综合 > 正文

[存档][不断更新中]android常见报错 adb报错总结

2013年10月01日 ⁄ 综合 ⁄ 共 1480字 ⁄ 字号 评论关闭
1.导入项目时常见报错,请参考http://blog.csdn.net/chuchu521/article/details/8106552

2.  adb无法工作的相关问题
问题1:手机连接电脑后,Eclipse中devices插件无法识别它,断开usb再连接还是不行。
解决方法: 打开任务管理器(cmd->taskmgr),结束adb.exe,再重新连接手机。

问题2:如果在任务管理器中看不到adb.exe进程,并且通过adb命令是可以找到设备的,例如:
adb devices
List of devices attached
HT849KV02954 device

则到DDMS里面,在Devices的框中,最后面有个小的倒三角形,你点一下,会出来一个框,你选择最下面的Reset adb。试试

向左转|向右转

http://zhidao.baidu.com/question/329007513.html

问题3:

android adb shell:unknown host service

我们在Windows DOS窗口中输入adb shell后,会出现如下错误:

 adb server is out of date.  killing... ADB server didn't ACK * failed to start daemon * error: unknown host service   ,

这是由于adb server的端口号5037被其他进程占用

怎么知道adb server的端口号?
正常启动adb会显示
排查端口被占用方法
在命令行中输入
netstat -ano

若发现
说明5037端口已经被占用
查看最后一项5260(它是一个进程的PID) 对应的进程
tasklist /fi "pid eq 5260"
我的命令行窗口中显示
接着杀死sjk_daemon.exe  (网上一般会提到是豌豆荚占用5037端口,我竟然遇到更奇葩的一个应用也占用了5037端口)
重启adb

3. 程序在Eclipse上编译通过,运行时遇到NoClassFoundException。
在Java Build Path面板中的libraries标签下引入所需的jar包没错,同时也要在Order and Export标签下导出对应的jar包。

4. 使用HttpClient的一个异常
Invalid use of SingleClientConnManager: connection still allocated.
Make sure to release the connection before allocating another one.

一般是HttpGet或HttpPost执行后返回的InputStream使用结束后没有关闭
StackOverflow的解答

To answer my own question: to release the connection (and any other resources associated with the request) you must close the InputStream returned by the HttpEntity:

InputStream is = entity.getContent();

.... process the input stream ....

is.close();       // releases all resources

另外,请看HttpEntity类的consumeContent()方法的注释部分 docs

抱歉!评论已关闭.