參考:http://blog.csdn.net/qq305013720/article/details/8934152 java
目前有三種解決方案,都是針對執行studio.bat出現錯誤致使android studio運行不起來,最後都是異工同曲:我用的第一種方法 android
1.改虛擬機配置文件studio.exe.vmoptions ubuntu
有人說是java環境變量,若是不會照着設置 windows
http://blog.csdn.net/huanghm88/article/details/3965218 android-studio
由於Eclipse一直在使用,因此環境變量應該是OK的!
緩存
而後我進android studio的安裝目錄(安裝時選擇的那個目錄,個人是默認的C:\Documents and Settings\用戶名\Local Settings\Application Data\Android\android-studio\bin)發現bin目錄有不少bat批處理,運行studio.bat提示 jvm
Unrecognized VM option '+UseCodeCacheFlushing' Could not create the Java virtual machine
ide
果斷在上述安裝目錄的bin目錄中找到 工具
windows 32的: this
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.
大概意思這個選項是用來避免代碼緩存溢出問題,若是你以爲不妥能夠其它兩個解決方案,我暫時沒發現問題
不過我在第一次生成工程文件的時候,報了一個錯,暫時還不知道是什麼問題
參考: