Android Studio Win7安装

让人等待已久的Google I/O 2013 大会没有给我们带来Android5.0,也没有带来Adnroid4.3等等,但带来了Android Studio,虽说是预览版,又是基于Intellij IDEA, 但是也无不让开发者们兴奋。看来,Google 要重视开发者们了。

作为学习Android开发的菜鸟,得知Android Studio  发布,很是迫不及待地来尝试一下效果如何。先是Linux下安装,安装起来没有遇到什么困难,感觉其所谓的图形界面还不错;又在Win7 下安装时,因为之前有安装Eclipse,在安装时它能自动查到已经安装的jdk(1.7),安装完,环境也配置后,然后重启(不要忘记重启一下,让设置的环境变量生效)。等很兴奋地要打开时,双击exe文件就是没有反应,不知怎么办。然后又cmd ,命令数据studio,结果显示如图:

Android Studio Win7安装

什么JDK没找到,安装开始的时候你不是自动查到JDK安装目录了吗,再往后看,难道是ANDROID_STUDIO_JDK,JDK_HOME,Java_HOME这三个变量设置有问题。

一番设置后,关机,重启,还是打不开,不甘心呐。上网搜,度娘不给力,还是用g哥,由于是新东西,网上相关内容也不多,只在StackOverflow上找到了,并且还与我遇到的问题一样,说什么JDK要1.6版本的,我擦,我才不信呢,1.7都这么久了,难道还不支持。程序猿有一颗愈挫愈勇的心,越是困难越想往前冲。

最后在安装目录下的bin目录中找到了一bat文件:studio.bat,打开一看,顿时觉悟:环境变量设置一定有问题,请看studio.bat内容:

@ECHO OFF

::----------------------------------------------------------------------
:: Android Studio startup script.
::----------------------------------------------------------------------

:: ---------------------------------------------------------------------
:: Locate a JDK installation directory which will be used to run the IDE.
:: Try (in order): ANDROID_STUDIO_JDK, ..\jre, JDK_HOME, JAVA_HOME.
:: ---------------------------------------------------------------------
IF EXIST "%ANDROID_STUDIO_JDK%" SET JDK=%ANDROID_STUDIO_JDK%
SET ADNROID_STUDION_JDK  <strong>:: 这句我加的,测试用打印出变量,linux下用echo ,win下用set</strong>
IF NOT "%JDK%" == "" GOTO jdk
IF EXIST "%~dp0\..\jre" SET JDK=%~dp0\..\jre
IF NOT "%JDK%" == "" GOTO jdk
IF EXIST "%JDK_HOME%" SET JDK=%JDK_HOME%
SET JDK_HOME
IF NOT "%JDK%" == "" GOTO jdk
IF EXIST "%JAVA_HOME%" SET JDK=%JAVA_HOME%
SET JAVA_HOME  <strong>:: 这句我加的,测试用打印出变量,linux下用echo ,win下用set</strong>
IF "%JDK%" == "" GOTO error

:jdk
SET JAVA_EXE=%JDK%\bin\java.exe
IF NOT EXIST "%JAVA_EXE%" SET JAVA_EXE=%JDK%\jre\bin\java.exe
IF NOT EXIST "%JAVA_EXE%" GOTO error

SET JRE=%JDK%
IF EXIST "%JRE%\jre" SET JRE=%JDK%\jre
SET BITS=
IF EXIST "%JRE%\lib\amd64" SET BITS=64

:: ---------------------------------------------------------------------
:: Ensure IDE_HOME points to the directory where the IDE is installed.
:: ---------------------------------------------------------------------
SET IDE_BIN_DIR=%~dp0
SET IDE_HOME=%IDE_BIN_DIR%\..

SET MAIN_CLASS_NAME=%ANDROID_STUDIO_MAIN_CLASS_NAME%
IF "%MAIN_CLASS_NAME%" == "" SET MAIN_CLASS_NAME=com.intellij.idea.Main

IF NOT "%ANDROID_STUDIO_PROPERTIES%" == "" SET IDE_PROPERTIES_PROPERTY="-Didea.properties.file=%ANDROID_STUDIO_PROPERTIES%"
SET IDE_HOME        <strong>:: 这句我加的,测试用打印出变量,linux下用echo ,win下用set</strong>
SET MAIN_CLASS_NAME<strong> :: 这句我加的,测试用打印出变量,linux下用echo ,win下用set</strong>
:: ---------------------------------------------------------------------
:: Collect JVM options and properties.
:: ---------------------------------------------------------------------
SET VM_OPTIONS_FILE=%IDE_BIN_DIR%\studio%BITS%.exe.vmoptions
SET ACC=
FOR /F "usebackq delims=" %%i IN ("%VM_OPTIONS_FILE%") DO CALL "%IDE_BIN_DIR%\append.bat" "%%i"
IF EXIST "%VM_OPTIONS_FILE%" SET ACC=%ACC% -Djb.vmOptionsFile="%VM_OPTIONS_FILE%"

SET COMMON_JVM_ARGS="-Xbootclasspath/a:%IDE_HOME%/lib/boot.jar" -Didea.paths.selector=AndroidStudioPreview %IDE_PROPERTIES_PROPERTY%
SET IDE_JVM_ARGS=-Didea.platform.prefix=AndroidStudio
SET ALL_JVM_ARGS=%ACC% %COMMON_JVM_ARGS% %IDE_JVM_ARGS% %REQUIRED_JVM_ARGS%

SET CLASS_PATH=%IDE_HOME%\lib\bootstrap.jar
SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\extensions.jar
SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\util.jar
SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\jdom.jar
SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\log4j.jar
SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\trove4j.jar
SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\jna.jar
SET CLASS_PATH=%CLASS_PATH%;%JDK%\lib\tools.jar
IF NOT "%ANDROID_STUDIO_CLASS_PATH%" == "" SET CLASS_PATH=%CLASS_PATH%;%ANDROID_STUDIO_CLASS_PATH%

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/19861.html