首页 > 代码库 > 搭建Android开发环境。
搭建Android开发环境。
Android 的 SDK Manager 无法启动 闪退解决方法
转自 http://hi.baidu.com/yangw80/item/7be029ebdb33390f65db0014
【故障描述】
做 Android 开发就要下载 Android SDK,其中的 SDK Manager.exe 无法启动,一闪而过。
尝试重装 JDK、重新从官网下载 Android SDK、添加环境变量等等均无效。
而且,有些版本的没事,有些版本的就不行。下载的 android-sdk_r14 可以正常执行 SDK Manager.exe,但是 android-sdk_r18 就不能执行,闪了一下就退出了。
【问题所在】
SDK Manager.exe 通过调用 android-sdk-windows\tools\lib\find_java.bat 确认 java.exe 的路径。
启用 cmd.exe,命令行切换路径到 android-sdk-windows\tools\lib,执行 find_java.bat,看到输出:
C:\Windows\system32\java.exe
虽然该路径下存在 java.exe,但是这并不是 jre 的安装路径。估计是由于某些需要 java 的软件在安装时,将 java.exe、javaw.exe、javaws.exe 复制到了 c:\windows\system32 下,导致 SDK Manager.exe 调用了错误位置的 java.exe 所致。
【解决办法】
知道了问题所在,解决起来就很容易了,删掉 C:\Windows\system32\ 下的 java.exe、javaw.exe、javaws.exe 即可解决。不放心的话,可以进入 cmd 再切换路径执行 find_java.bat 检查一下,输出:C:\Program Files\Java\jre7\bin\java.exe 就没问题了。
3. 如大神的步骤运行 find_java.bat之后被告知:
F:\************************\sdk\tools\lib>find_java.bat
ERROR: No suitable Java found. In order to properly use the Android Developer
Tools, you need a suitable version of Java JDK installed on your system.
We recommend that you install the JDK version of JavaSE, available here:
http://www.oracle.com/technetwork/java/javase/downloads
If you already have Java installed, you can define the JAVA_HOME environment
variable in Control Panel / System / Avanced System Settings to point to the
JDK folder.
You can find the complete Android SDK requirements here:
http://developer.android.com/sdk/requirements.html
4. 接着百度,得知 运行命令可Check Java 得版本是否正确:
C:************>java -version‘java‘ 不是内部或外部命令,也不是可运行的程序或批处理文件。
关于什么是 JDK 和 JRE: http://stackoverflow.com/questions/1906445/what-is-the-difference-between-jdk-and-jre
JRE: Java Runtime Environment. It is basically the Java Virtual Machine where your Java programs run on. It also includes browser plugins for Applet execution.
JDK: It‘s the full featured Software Development Kit for Java, including JRE, and the compilers and tools (like JavaDoc, and Java Debugger) to create and compile programs.
Usually, when you only care about running Java programs on your browser or computer you will only install JRE. It‘s all you need. On the other hand, if you are planning to do some Java programming, you will also need JDK.
Sometimes, even though you are not planning to do any Java Development on a computer, you still need the JDK installed. For example, if you are deploying a WebApp with JSP, you are technically justrunning Java Programs inside the application server. Why would you need JDK then? Because application server will convert JSP into Servlets and use JDK to compile the servlets. I am sure there might be more examples.
DownLoad JDK Page :http://www.oracle.com/technetwork/java/javase/downloads/index.htmlDownLoad JDK Link:http://download.oracle.com/otn-pub/java/jdk/8u25-b18/jdk-8u25-windows-x64.exe下载后开始安装
7. Ctrl + R,再次运行 java -version 显示如下:
C:************>java -versionjava version "1.8.0_25"Java(TM) SE Runtime Environment (build 1.8.0_25-b18)Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
9. API下载完成后,开始安装eclipse,双击Eclipse.exe, 然后选定WorkSpace路径即可。
搭建Android开发环境。