Getting Android Studio 4.2 Canary To Run Again
If you are like me, when Android Studio 4.2 Canary 8 came out, it would crash on startup with:
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Error occurred during initialization of VM
Multiple garbage collectors selected
This has been reported for Ubuntu, macOS, Arch Linux, and (albeit with an incorrect title) Chrome OS.
Thanks to this comment, it is more clear what is going on.
When Android Studio 4.2 runs for the first time,
it creates a $HOME/.config/Google/AndroidStudioPreview4.2/
directory and dumps a bunch of files and directories in there. One is studio64.vmoptions
, which
contains a bunch of java
command-line options that presumably get applied when
launching Studio via studio.sh
.
One of those, -XX:+UseConcMarkSweepGC
, seems to be what is triggering this crash.
So, see if you have that file — if you are getting this crash, you should. Just edit the file, remove that line, and save your changes. I was able to get Canary 9 to start after that, and while I did not test Canary 8, my guess is that this fix will handle it as well.
There may be a better fix than removing this line, and ideally we would not have to manually edit this file. But, this is better than nothing.