Android 开发环境需要:Eclipse,Java环境,ADT,android SDK。 每个软件的下载地址,及详细的安装过程,可以参考网上各种文章。
我之前安装过Android开发环境,因为在安装Android SDK的时候出错,以为是GWF问题,而且因为当时有其它事情,就没有去查原因,今天,为了做个简单的程序,再次安装,遇到如下几个问题:
1. 使用https下载出错
运行“SDK Setup.exe”,提示:“Failed to fetch URL https://dl-ssl.google.com/android/repository/repository.xml, reason: HTTPS SSL error. You might want to force download through HTTP in the settings.”
按照提示, 在settings中,勾选“Force https://… sources to be fetched using http://…”,强制使用http协议,解决了问题。
2. A folder failed to be renamed or moved
网速特别忙,等啊等,终于下载完了,在安装的过程中提示:“-= Warning ! =-
A folder failed to be renamed or moved. On Windows this typically means that a program is using that folder (for example Windows Explorer or your anti-virus software .) ………”。 意思说,将杀毒软件及使用“/Android SDK/tools”目录的相关程序关掉。
我将 MaAfee杀毒软件及防火墙关掉,将windows 文件浏览器也都关掉了,进程中可能存在的“adb.exe”进程也关掉了,甚至机器都重启了好几次,都提示相同的错误。
无可奈何,只有“/Android SDK/tools”自己可能使用这个目录了,难道是我win7 64位系统有这个问题? 痛苦中…….,安装程序是否可以不使用“/Android SDK/tools”?
我最后,没有再使用自动安装程序,从https://dl-ssl.google.com/android/repository/repository.xml提取出非linux及非macosx下的zip文件,见如下地址:
下面的6个文件,解压缩到:/Android SDK/platform/下面
https://dl-ssl.google.com/android/repository/android-1.1_r1-windows.zip
https://dl-ssl.google.com/android/repository/android-1.5_r03-windows.zip
https://dl-ssl.google.com/android/repository/android-2.0_r01-windows.zip
https://dl-ssl.google.com/android/repository/android-2.0.1_r01-windows.zip
https://dl-ssl.google.com/android/repository/android-1.6_r02-windows.zip
https://dl-ssl.google.com/android/repository/android-2.1_r01-windows.zip
如下文件解压缩到:/Android SDK/tools/下面
https://dl-ssl.google.com/android/repository/tools_r05-windows.zip
如下文件解压缩到:/Android SDK/usb_driver/下面
https://dl-ssl.google.com/android/repository/usb_driver_r03-windows.zip
如下文件解压缩到:/Android SDK/add-ons/下面
https://dl-ssl.google.com/android/repository/google_apis-3-r03.zip
https://dl-ssl.google.com/android/repository/google_apis-4_r02.zip
https://dl-ssl.google.com/android/repository/google_apis-5_r01.zip
https://dl-ssl.google.com/android/repository/google_apis-6_r01.zip
https://dl-ssl.google.com/android/repository/google_apis-7_r01.zip
解压后,即完成安装。
3. emulator: ERROR: unknown virtual device name: ‘****’
在运行程序, 在手机模拟器中查看结果的时候,发现如下错误:
emulator: ERROR: unknown virtual device name: ’****’
emulator: could not find virtual device named ’****’
具体原因,是因为我修改了用户文档目录,修改到了F盘目录下。 我将“F:\Users\账号\”下面的“.android”复制一份到到“C:\Users\ 账号\”下即可。
附带两张运行成功效果图:
android example
android example 1
附加:对于第二个问题,我搜到了一个解决方法,如下:
I had the same problem: the latest update failed to install because it couldn't
rename the tools folder in android-sdk-windows. I'm using Avira antivirus and
disabling it didn't help, but I don't think it had anything to do with the AV program
anyway.
Fact is, running the Android SDK setup apparently uses items in the
"android-sdk-windows\tools" directory. I'm on Win 7 x64 so maybe that causes some
unique situation - I'm not sure.
Solution:
- I made a copy of the tools folder itself (keeping it at the same directory tree
level, thus "tools" and "tools-copy" were both in the "android-sdk-windows" folder).
- I ran Android.bat from that copy
- I ran the update without problems (it updated the original,
not-being-used-at-the-moment tools folder, among whatever other items it needed to).
- I closed the SDK, deleted the folder (I had to kill the adb.exe process first - not
sure why that always persists but you can't delete the folder without doing that).
- I restarted the SDK from the normal (now-updated) tools folder. Worked like a charm!
Note that simply killing adb.exe was NOT sufficient to get around the original
issue... only by copying the tools folder and using the copy to run Android for the
duration of the update process was enough to rectify the problem.
I hope this helps others... it's quite vexing to have to spend time resolving basic
issues like this just to run an update.
最后,十分感谢GWF,并没有将的所有的相关网址都屏蔽掉,知道我还是搜索到了很多有用的信息!