Hello,
I’ve been toying with the Android SDK in Visual Studio 2012 and for some reason, compiling my code tends to cause the following three errors:
1.()Error: Could not create the Java Virtual Machine.
2.()Error: A fatal exception has occured. Program will exit.
3.(AP1)Error while running Android tool: dx.bat.
This frequently happens after making and correcting a code error and restarting my computer, Visual Studio, or the Android Virtual Device doesn’t change anything.
this is an unknown bug. Could you please provide exact steps on how to reproduce that error. Does it reproduces for any project or a particular one? If it is a particular project could you give it to us so we can fix the problem.
Also what VS do you have?
this is an unknown bug. Could you please provide exact steps on how to reproduce that error. Does it reproduces for any project or a particular one? If it is a particular project could you give it to us so we can fix the problem.
Also what VS do you have?
Thanks in advance.
Hi viktoriad,
I’ll try to answer your questions below.
I’m not really sure what part of it caused the error, but I did the following:
Create a new Android application, the standard template.
Do some changes to the code, each one including the example provided on the
wiki and the web tutorials related to making a toast appear when the button is
pressed.
Make an error sooner or later.
Fix the error.
After I do all of the above I eventually find myself unable to compile the code, with VS throwing out the above error set.
It happens for any project, though sometimes if I try running the last working build it works properly. Not always though.
I’ll write down the information, hopefully it’s what you’re looking for:
Microsoft Visual Studio 2012 Shell (Integrated)
Version 11.0.50727.1 RTMREL
Microsoft .NET Framework
Version 4.5.50709
Installed products: RemObjects Everwood 4.0.33.371, RemObjects Oxygene 5.2.37.1071.
I’ll try, though I’ve heard that it may in fact be related to Java itself.
Also, your product version check is saying “All your projects are up to date!” despite the fact that it’s not yet true. You might want to see if it’s working properly.
Sorry for the delay. We tried to reproduce your problem on several machines but couldn’t.
What version did you try? I checked and seems the working version is any latest betta. Also could you please set Detailed output for VS (Tools => Options => Projects and Solutions => Build and run => Select Detailed in the MSBuild project output verbosity). Next time when you experiense the problem please send us the output log so we can examine what exactly happens.
nevenpjr said: Also, your product version check is saying "All your projects are up to date!" despite the fact that it's not yet true. You might want to see if it's working properly.
my apologies, it looks like the info was not updated for the freshly released September build, yet. fixed now.
Uhhhhh… why does it keep erasing my posts and attachments at will!?
Oh well, attaching it again. Probably missed some hidden step like the one mentioned in my previous post…
Edit: Yeah, whatever wanted me to TRY posting twice also wanted me to reattach it before the second attempt. Interesting.
Re-edit: I’m trying to figure out a solution myself, but I need to know where the .ini files for the JVM are located. Based on a similar issue I’ve been reading about (true now, that’s an Eclipse issue, but it may be the same thing), Java may be trying to allocate more memory to the JVM than it can. (2 GB RAM, but… if the settings are wrong, it could be a problem)
The error from the log definitelly sounds like “Out of memory” error. We are using Xmx1024M by default when running java so probably it is the problem in your case. Unfortunatelly it is not possible to changes that default value to e.g.512 now. I have logged an issue for furthe review (bugs://58635).
Yeah, I read about it on stackoverflow.com. From what I understand, it tries to make sure there’s Xmx1024M + XXMaxPermSize (which appears to be 512 MB by default) RAM available, and cutting my memory usage to 1/4 of my capacity is a bit tricky. But hopefully I’ll get an upgrade soon.
Anyway, I’ve doubled my memory to 4 GB and it still reports the same issue. Strangely enough, it did seem to work every once in a while back before I made the original post, but the crashing was the rule rather than the exception.
Which means there’s another problem, or something’s gone wrong since then. But according to Windows’ resource monitor, I’m only using 50% of my RAM.
Microsoft Visual Studio 2012 Shell (Integrated)
Version 11.0.50727.1 RTMREL
Microsoft .NET Framework
Version 4.5.50709
RemObjects Oxygene 5.2.40.1081
RemObjects Oxygene
???
thanks
Willian
error :
Run: “C:\Program Files (x86)\Java\jre7\bin\java.exe” -Xmx1024M -jar “C:\Users\willian\AppData\Local\Android\android-sdk\platform-tools\lib\dx.jar” --dex --verbose --output=“C:\Users\willian\documents\visual studio 2012\Projects\org.me.androidapplication1\org.me.androidapplication1\obj\Debug\classes.dex” --positions=lines “C:\Users\willian\documents\visual studio 2012\Projects\org.me.androidapplication1\org.me.androidapplication1\obj\Debug\org.me.androidapplication1.jar”
Error occurred during initialization of VM
Could not reserve enough space for object heap
C:\Program Files (x86)\MSBuild\RemObjects Software\Oxygene\RemObjects.Oxygene.Android.targets(76,3): error : Error: Could not create the Java Virtual Machine.
C:\Program Files (x86)\MSBuild\RemObjects Software\Oxygene\RemObjects.Oxygene.Android.targets(76,3): error : Error: A fatal exception has occurred. Program will exit.
Few versions of Java are installed together, just try to uninstall all Java installations from your machine and install the latest Java JDK for your OS, make sure you install the x64 version if you are using a 64bit OS.
2)The heap size allocated for java virtual machine is not big enough. Try to increase the maximum heap size. For this you can pass some parameters in command line to java. The parameters may be:
-Xms (initial Java heap size)
-Xmx (maximum Java heap size)
-Xss (java thread stack size)
I think it’s becoming clear that this is not really an Oxygene issue per se, but a general issue with the Java VM on the affected systems. IMHO we’ll need to check with Java support on this.
After updating my JDK from 7 to 9, I managed to get a successful compile, however the program crashed due to a previously undetected error in the code.
Upon switching to a more functional version (the standard template, to be exact), I first had the same issue as before, but after restarting my computer, only the 3rd error from my original post remained.
I haven’t tried the second option ekaterina mentioned, but that’s because I don’t quite understand how to do it.
Attaching another log just in case.
Edit: Well that’s nice. I didn’t have to try twice to make it work. Website update, I presume?
Sorry, I was wrong suggesting to tune Java options, it’s not possible in this case, because we are using definite values (Xmx1024M) when running java. Also we cannot simply change the allocated memory because it can cause problems to other users.
This is not Oxygene, but Java issue.