5
votes

I am new to xamarin.android apps. i download the one maps project from http://developer.xamarin.com/samples/MapsAndLocationDemo/ and i'm trying to run the app in visual studio 2013, while debugging i'm getting error like "Java.exe" exited with code 1. i'm trying to solve it but i failed. i also faced some other problems, at last i solve those. but this error is still there. when i try to find the error it show the code like below

<CompileToDalvik 
DxJarPath="$(DxJarPath)"
JavaToolPath="$(JavaToolPath)"
JavaMaximumHeapSize="$(JavaMaximumHeapSize)"
JavaOptions="$(JavaOptions)"
ClassesOutputDirectory="$(IntermediateOutputPath)android\bin\classes"
MonoPlatformJarPath="$(MonoPlatformJarPath)"
JavaSourceFiles="@(AndroidJavaSource)" 
JavaLibraries="@(AndroidJavaLibrary)"
ExternalJavaLibraries="@(AndroidExternalJavaLibrary)"
LibraryProjectJars="$(IntermediateOutputPath)__library_projects__\*.jar"
DoNotPackageJavaLibraries="@(_ResolvedDoNotPackageAttributes)"
ToolPath="$(DxToolPath)"
ToolExe="$(DxToolExe)"
UseDx="$(UseDx)"
AdditionalJavaLibraryReferences="@(_AdditionalJavaLibraryReferences)"
/>

File path location "C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets" if any one face similar problem please help me to rectify the problem. Thanks in advance.

9
look at the build log. View -> Pads -> Errors -> Build Output (in Xamarin Studio). There you will see what prompts the error. Also change log verbosity to Diagnostic if you can't find the error by going to Tools -> Options -> Projects -> Build -> General Tab -> Log verbosity. - Alex.F

9 Answers

6
votes

It looks like the program was trying to allocate too much space to the Java Heap. You can change this by going to the Android Project Options > Android Build > Advanced and then changing the Java Heap size to 1G.

5
votes

You need to look closer in the build error logs. You'll find Progaurd complaining about several classes.

What you need is write the following lines:

-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**

Into file named proguard.cfg. Add it inside Android project in the solution. Make sure you set Build Action to ProguardConfig.

Finally, make sure you save file as UTF-8 and NOT UTF-8 BOM

1
votes

I encountered this problem on a colleague's computer after he updated Xamarin. The problem ended up being that his old sdk was installed under Program Files, while the update installed it under AppData. Changing this folder under Options > Xamarin > Android in Visual Studio solved the problem for him.

1
votes

This can happen if you have syntax errors or unsupported characters within your Proguard.cfg file.

In my case, removing the comment in my otherwise empty Proguard.cfg file did not resolve the problem of an 'unsupported character'. Deleting the file altogether was a quick and dirty workaround.

0
votes

Download latest version of JAVA JDK and change the reference in Tools->Options->Xamarin->JDK location to point to it (ie C:\Program Files\Java\jdk1.8.0_111).

Hope this helps.

0
votes

Increase the HeapSize

From Visual Studio > right click Android Project> Properties> Android Options > Advanced> Java Max Heap Size > 1G

-1
votes

I just had this problem. Rather than trying to fix it by increasing the heap size, I was able to fix it by going to Build -> Clean Solution, and then Rebuild Solution.

-1
votes
**Error : while running app “Java.exe” exited with code**
I resolved this by manually overriding the java heap size: In Visual Studio: Right-click on Project

->Click andriod properties  
-> Click Android Options
->select Advanced tab
->Advanced android build settings 
Set Java MAx Heap Size to 1G (Or larger depending)

The project now builds. Hope this helps. :)

OR

-1
votes

Just resolved my problem by Unchecking Enable Proguard option.

Go To : Project Properties > Android Project Options > Android Build > Advanced Tab > Uncheck Enable Proguard