您的位置:首页 > 移动开发 > Android开发

windows ubuntu Android studio安装好启动没反应解决方法

2014-07-07 10:06 411 查看

参考:/article/10703332.html
目前有三种解决方案,都是针对执行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目录中找到

windows 32的:

studio.exe.vmoptions文件,去掉里面包含UseCodeCacheFlushing的那一行

windows 64的:

studio.exe.64vmoptions文件,去掉里面包含UseCodeCacheFlushing的那一行

ubuntu 32的:

studio.vmoptions文件,去掉里面包含UseCodeCacheFlushing的那一行

ubuntu 64的:

studio64.vmoptions文件,去掉里面包含UseCodeCacheFlushing的那一行

重新运行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.

大概意思这个选项是用来避免代码缓存溢出问题,如果你觉得不妥可以其它两个解决方案,我暂时没发现问题

不过我在第一次生成工程文件的时候,报了一个错,暂时还不知道是什么问题



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐