0

Hello friends I am facing an error message whenever I am launching android studio.The error is failed to create jvm error code -1 .See the below image for the complete error message I tried to find solution on Google, but I didn't find any solution. Thanks

My laptop config is

win7 64bit i5 intel 8 gb 6 gb ram 1 tb hard disk

My android studio vmopetion file is

      #
  # *DO NOT* modify this file directly. If there is a value that you would like to override,
  # please add it to your user specific configuration file.
  #
  # See http://tools.android.com/tech-docs/configuration
  #
  -Xms256m
  -Xmx1280m
  -XX:MaxPermSize=350m
  -XX:ReservedCodeCacheSize=240m
  -XX:+UseConcMarkSweepGC
  -XX:SoftRefLRUPolicyMSPerMB=50
  -da
  -Djna.nosys=true
  -Djna.boot.library.path=

  -Djna.debug_load=true
  -Djna.debug_load.jna=true
  -Dsun.io.useCanonCaches=false
  -Djava.net.preferIPv4Stack=true
  -XX:+HeapDumpOnOutOfMemoryError
  -Didea.paths.selector=AndroidStudio2.1
  -Didea.platform.prefix=AndroidStudio

my java version is 1.8.0_91

img

2 Answers2

4

I have the same problem which triggered after i changed vmoptions file.This worked for me

  1. Go to C:\Users\ username \.androidStudio\

2.Find the studio.exe.vmoptions (or studio64.exe.vmoptions) and simply type -Xmx4g (or -Xmx2g if you want to allocate 2GB RAM) Here 4g is for allocating 4GB RAM to android studio.

Praveen Cool
  • 261
  • 1
  • 4
  • 13
0

Open file located at /Applications/Android\ Studio.app/Contents/bin/studio.vmoptions Change the content to

-Xms128m -Xmx4096m -XX:MaxPermSize=1024m -XX:ReservedCodeCacheSize=200m -XX:+UseCompressedOops

Xmx specifies the maximum memory allocation pool for a Java Virtual Machine (JVM), while Xms specifies the initial memory allocation pool. Your JVM will be started with Xms amount of memory and will be able to use a maximum of Xmx amount of memory.

Save the studio.vmoptions file and restart Android Studio.

  • i am using android studio 2.1.2 –  Jun 22 '16 at 12:09
  • You can have multiple JDK versions installed on your computer, but you need your JAVA_HOME variable to point to the installation of JDK v1.8 for Android Studio to work: JAVA_HOME=C:\Program Files\Java\jdk1.8.0_91 Also, download the correct 64-bit version of JDK v1.8 for your current operating system. – Dungeon_master Jun 23 '16 at 07:22
  • @nEwDeV Also I have modified the answer please check – Dungeon_master Jun 23 '16 at 07:30