近来要参与到一个Android项目中,因为之前没接触过Android,所以在搭建环境的过程中遇到了几个问题,在这里写写,供大家参考:
1、 搭建环境时出现的问题 参考:http://blog.csdn.net/sheshou2/article/details/6152988
错误信息提示
[2013-01-1009:48:01 - Info] ------------------------------
[2013-01-10 09:48:01 - Info] Android Launch!
[2013-01-10 09:48:01 - Info] Connection with adb was interrupted.
[2013-01-10 09:48:01 - Info] 0 attempts have been made to reconnect.
[2013-01-10 09:48:01 - Info] You may want to manually restart adb from theDevices view.
解决办法
重新启动eclipse
错误信息提示
[2013-01-1009:48:02 - WhNews Android Client] ------------------------------
[2013-01-10 09:48:02 - WhNews Android Client] Android Launch!
[2013-01-10 09:48:02 - WhNews Android Client] The connection to adb is down,and a severe error has occured.
[2013-01-10 09:48:02 - WhNews Android Client] You must restart adb and Eclipse.
[2013-01-10 09:48:02 - WhNews Android Client] Please ensure that adb iscorrectly located at 'D:\Program Files\android-sdk-windows \platform-tools\adb.exe'and can be executed.
解决办法
查看任务管理器,关闭所有adb.exe,然后重启eclipse即可
2、 模拟器问题
搭建好环境后,模拟器上的按键不能使,提示“DPAD not enabled AVD”,如图1所示
图1
解决办法是:Window——>AndroidVirtual Device Manager——>选项卡的Device Definitions页面——>选中一个Device,点击【Clone】按钮,自己设置数据,关键是要如图2那样设置Device。选中clone出来的Device——>点击按钮“Create AVD”,设置相应的参数即可!如图3所示。
图2
图3
3、出现的问题:
Failed to fectch URl https://dl-ssl.google.com/android/repository/addons_list.xml, reason: Connection to https://dl-ssl.google.com refused
解决办法:
用notepad打开C:\Windows\System32\drivers\etc中的hosts文件,在最后一行添加
74.125.237.1 dl-ssl.google.com