android studio 安装问题

来源:互联网 发布:现货农产品交易软件 编辑:程序博客网 时间:2024/04/28 22:00



昨晚Google I/O大会上发布android应用的最新IDE开发平台android studio,今天一大早就下载来安装,安装发现运行不起来!

目前有三种解决方案,都是针对执行studio.bat出现错误导致android studio运行不起来,最后都是异工同曲

1.改虚拟机配置文件studio.exe.vmoptions

有人说是java环境变量,如果不会照着设置

http://blog.csdn.net/huanghm88/article/details/3965218

因为Eclipse一直在使用,所以环境变量应该是OK的!

然后我进android studio的安装目录(安装时选择的那个目录,我的是默认的C:\Documents and Settings\用户名\Local Settings\Application Data\Android\android-studio\bin)发现bin目录有很多bat批处理,运行studio.bat提示

Unrecognized VM option '+UseCodeCacheFlushing' Could not create the Java virtual machine

果断在上述安装目录的bin目录中找到studio.exe.vmoptions文件去掉里面包含UseCodeCacheFlushing的那行

结果又出现出现 -XX:+HeapDumpOnOutOfMemoryError 错误


我参考别人的http://blog.csdn.net/zjbpku/article/details/8937201 

原来是我之前使用的事JDK1.5 

重新运行Android Studio终于出现令人激动的画面


发现网上还有其它解决方案:

2.修改批处理studio.bat

解答下32位 win7系统的问题。
进入控制台,cd到 android-studio\bin 目录下,执行studio.bat
查看报错信息。
1. 网上有一种情况是没有找到javahome,说明可能是jdk环境变量的问题,这时可以进去计算机高级系统设置里面查看下
2.我个人遇到的情况是,Unrecognized VM option '+UseCodeCacheFlushing' Could not create the Java virtual machine
创建不了虚拟机,我的java环境变量已经设置。

用文本工具打开
studio.bat
line25 to line 28:
SET JRE=%JDK%
IF EXIST "%JRE%\jre" SET JRE=%JDK%\jre
SET BITS=
IF EXIST "%JRE%\lib\amd64" SET BITS=64

可以看到里面设置软件支持系统位数是64位,而我自己所用电脑是32位的 jre/lib目录下只有i386文件
尝试把
IF EXIST "%JRE%\lib\amd64" SET BITS=64 改为
IF EXIST "%JRE%\lib\i386" SET BITS=32

3.同样是修改批处理studio.bat,修改的地方变了

对于32位的xp系统

SET BITS=

改为SET BITS=32

64位系统不变



PS:对于网友提问UseCodeCacheFlushing是什么意思,查到如下说明

http://blog.codecentric.de/en/2012/07/useful-jvm-flags-part-4-heap-tuning/

-XX:+UseCodeCacheFlushing
If the code cache grows constantly, e.g., because of a memory leak caused by hot deployments, increasing the code cache size will only delay its inevitable overflow. To avoid overflow, we can try an interesting and relatively new option: to let the JVM dispose some of the compiled code when the code cache fills up. This may be done by specifying the flag -XX:+UseCodeCacheFlushing. Using this flag, we can at least avoid the switch to interpreted-only mode when we face code cache problems. However, I would still recommend to tackle the root cause as soon as possible once a code cache problem has manifested itself, i.e., identify the memory leak and fix it.
大概意思这个选项是用来避免代码缓存溢出问题,如果你觉得不妥可以其它两个解决方案,我暂时没发现问题

原创粉丝点击