Cannot run Android Studio - Invalid ReservedCodeCacheSize

Viewed 345

I downloaded Android Studio for Ubuntu and every time I try to run ./studio.sh from the bin folder to run it I get this error message:

Invalid ReservedCodeCacheSize=4000M. Must be at most 2048M.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Here are my studio.vmoptions and studio64.vmoptions files for reference

studio.vmoptions

-server
-Xms256m
-Xmx768m
-XX:ReservedCodeCacheSize=240m
-XX:+UseG1GC
-XX:SoftRefLRUPolicyMSPerMB=50
-XX:CICompilerCount=2
-Dsun.io.useCanonPrefixCache=false
-Djdk.http.auth.tunneling.disabledSchemes=""
-Djdk.attach.allowAttachSelf=true
-Dkotlinx.coroutines.debug=off
-Djdk.module.illegalAccess.silent=true
-Djna.nosys=true
-Djna.boot.library.path=
-Didea.vendor.name=Google
-Dawt.useSystemAAFontSettings=lcd
-Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine
-Dsun.tools.attach.tmp.only=true

studio64.vmoptions

-Xms256m
-Xmx1280m
-XX:ReservedCodeCacheSize=240m
-XX:+UseG1GC
-XX:SoftRefLRUPolicyMSPerMB=50
-XX:CICompilerCount=2
-Dsun.io.useCanonPrefixCache=false
-Djdk.http.auth.tunneling.disabledSchemes=""
-Djdk.attach.allowAttachSelf=true
-Dkotlinx.coroutines.debug=off
-Djdk.module.illegalAccess.silent=true
-Djna.nosys=true
-Djna.boot.library.path=
-Didea.vendor.name=Google
-Dawt.useSystemAAFontSettings=lcd
-Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine
-Dsun.tools.attach.tmp.only=true

I currently have openjdk-8-jdk and openjdk-11-jdk installed

If there is any way anyone can help me I'd apppreciate it!

2 Answers

I fixed it, I basically was editing the wrong studio64.vmoptions file, I edited the one in ~/.config/Google/AndroidStudio4.2 and everything was working fine afterwards

on macOS 12.4 ~/Library/Application Support/Google/AndroidStudio2021.2/studio.vmoptions

Related