When trying to launch Android Studio on Windows I get the following error:
Failed to create JVM: error code -1 JVM Path: C:\Program Files\Java\jdk1.8.0_91\jre
I have tried setting the JAVA_PATH variable and I have also tried uninstalling Android Studio and Java and then reinstalling. I came to this error while trying to mess with the path variables to use an external Java library.
Any suggestions on fixing this problem?
EDIT: The solution I gave below seems to work for error code -1 and -4 in my case. The only issue is that you lose your user settings if you use the solution given.