5

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.

1
  • 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. Commented Oct 21, 2014 at 7:55

10 Answers 10

7

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Could you teach me where to find this in Visual Studio 2022?
5

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

Comments

1

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.

Comments

1

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.

Comments

0

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.

Comments

0

Increase the HeapSize

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

Comments

0

You can also try by going to Android Project Options > Android Build > Linker > Linker Behaviour set to Don't Link

Comments

-1

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.

Comments

-1
**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

Comments

-1

Just resolved my problem by Unchecking Enable Proguard option.

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.