Note the version I am using is 4.1, yours might be different.
So I faced this problem because I was trying to speed up my android studio, I followed some steps for a user in GitHub, and after I closed my android studio and tried to reopen it the JVM JRE error kept showing up. Java home and everything is set up already, so here I will show you how to recover from such an error.
here are the files I edited and caused the error to happen: Android Studio is slow (how to speed up)?
To solve the problem:
you have to delete the folder that is causing the problem which is called studio.exe.vmoptions
or if you are using 64-bit version: studio64.exe.vmoptions
If you are using 32/64 bit, it can be found in the location where you have downloaded android studio in the bin folder, the bin folder also contains the exe files that runs android-studio.
The default download location for android studio is in:
C:\Program Files\Android\Android Studio\bin\*.vmoptions
also, you will have to delete the same file from another location:
32-bit version from:
C:\Users\USERNAME\.AndroidStudio2.3\studio64.exe
64-bit Version from: C:\Users\USERNAME\AppData\Roaming\Google\AndroidStudio4.1\studio64.exe.vmoptions
Deleting these files worked for me, hopefully, it does for you too.