配置Android开发环境,各项工作都做好了,新建了个Hello Android项目做测试,提示ERROR: Unknown command 'crunch' 。
在网上搜了若干种解决方法,好不容易才把这个问题解决了。
首先,出现ERROR: Unknown command 'crunch' ,通常是因为我们在配置环境时只更新了ADT而没有对Android SDK tools 和Android SDK Platform-tools进行及时的更新,所以必须打开SDK manager,对tools文件夹下的两个插件进行更新。
可是,通过SDK Manager进行更新时,总是提示
Failed to fetch URL https://dl-ssl.google.com/android/repository/addons_list.xml, reason: Connection to https://dl-ssl.google.com refused
很多网友也都说这些更新网站访问不了,大概是https 与 http的原因,https协议涉及到网站信息的加密,总是会出现问题。网上提供的一种解决方法是在SDK Manager ->Tools里面设置,将https强制转化为http连接。可是我怎么也总不到这个选项,尝试Add new external add-on sites (以http协议传输),仍然失败,错误信息如下:
ERROR: Failed to fetch URL http://dl-ssl.google.com/android/repository/addons_list-1.xml, reason: hostname in certificate didn't match:!=
究竟该如何通过http协议访问更新呢? 功夫不负有心人,求助万能的Google,终于发现另一种解决方案!
找到C:\Documents and Settings\Administrator\.android\androidtool.cfg文件,在最后一行加入sdkman.force.http=true
保存,关闭,打开eclipse->SDK Manager, checked tools下面的两个方件夹,开始SDK Tools和SDK platform-tools的更新。
重启,测试Hello Android, 问题解决!
国内访问Google相关的网站及服务总是比较慢,最近看到一个加速访问的方法,亲测有效。
1. Windows用户找到C:\windows\system32\drivers\etc下的hosts文件,Linux用户打开/etc/hosts文件。
在文件末端加上:
203.208.46.146 www.google.com
203.208.46.147 www.google.com.hk203.208.46.132 clients1.google.com203.208.46.149 mail.google.com203.208.46.161 chatenabled.mail.google.com203.208.46.161 mail-attachment.googleusercontent.com注:win7下如果直接修改hosts文件可能会有权限问题。可以先将hosts文件拖到桌面,修改后拖回原处即可。
2. 刷新DNS:打开cmd,敲下ipconfig/flushdns,按回车。
3.登陆Gmail,看看效果如何。
下边贴上使用Google各种服务在修改hosts文件时需要添加的内容。
#Google Service#Chrome 网上应用203.208.46.146 chrome.google.com203.208.46.146 clients0.google.com203.208.46.146 clients1.google.com203.208.46.146 clients2.google.com203.208.46.146 clients3.google.com203.208.46.146 clients4.google.com203.208.46.146 www.googleusercontent.com203.208.46.146 lh0.googleusercontent.com203.208.46.146 lh1.googleusercontent.com203.208.46.146 lh2.googleusercontent.com203.208.46.146 lh3.googleusercontent.com203.208.46.146 lh4.googleusercontent.com203.208.46.146 lh5.googleusercontent.com203.208.46.146 lh6.googleusercontent.com203.208.46.146 clients1.googleusercontent.com203.208.46.146 clients2.googleusercontent.com#网页快照203.208.46.146 webcache.googleusercontent.com#Google SSL203.208.46.146 encrypted.google.com203.208.46.146 encrypted.google.com.hk#Google Docs203.208.46.146 docs.google.com203.208.46.146 docs0.google.com203.208.46.146 docs1.google.com203.208.46.146 docs2.google.com203.208.46.146 docs3.google.com203.208.46.146 spreadsheets.google.com203.208.46.146 spreadsheets0.google.com203.208.46.146 spreadsheets1.google.com203.208.46.146 spreadsheets2.google.com203.208.46.146 spreadsheets3.google.com#Gmail203.208.46.146 mail.google.com203.208.46.146 chatenabled.mail.google.com #Gmail中Gtalk聊天服务#Google 搜索203.208.46.146 www.google.com#Google preview203.208.46.146 www.googlepreview.com#Google 翻译203.208.46.146 translate.google.com203.208.46.146 translate.googleapis.com#Google 搜索建议(IE9)203.208.46.146 clients5.google.com#Google Code203.208.46.146 code.google.com#Picasa 网络相册203.208.46.146 picasaweb.google.com203.208.46.146 lh0.ggpht.com203.208.46.146 lh1.ggpht.com203.208.46.146 lh2.ggpht.com203.208.46.146 lh3.ggpht.com203.208.46.146 lh4.ggpht.com203.208.46.146 lh5.ggpht.com203.208.46.146 lh6.ggpht.com203.208.46.146 lh7.ggpht.com203.208.46.146 lh8.ggpht.com203.208.46.146 lh8.ggpht.com203.208.46.146 lh9.ggpht.com203.208.46.146 lh6.google.com#Google 个人资料203.208.46.146 profiles.google.com203.208.46.146 browsersync.google.com#Google+203.208.46.146 talkgadget.google.com #Google+中的聊天服务203.208.46.146 ssl.gstatic.com203.208.46.146 images-pos-opensocial.googleusercontent.com203.208.46.146 images1-focus-opensocial.googleusercontent.com203.208.46.146 images2-focus-opensocial.googleusercontent.com203.208.46.146 images3-focus-opensocial.googleusercontent.com203.208.46.146 images4-focus-opensocial.googleusercontent.com203.208.46.146 images5-focus-opensocial.googleusercontent.com203.208.46.146 images6-focus-opensocial.googleusercontent.com203.208.46.146 plus.google.com#Download 下载203.208.46.146 dl.google.com203.208.46.146 dl-ssl.google.com#Groups203.208.46.146 groups.google.com#Google URL Shortener203.208.46.146 goo.gl#Google App Engine203.208.46.146 appengine.google.com#Android Developer74.125.113.121 developer.android.com