Ranjith Kumar Nagiri
Ranjith Kumar Nagiri

Reputation: 863

"java.exe" exited with code 1 Error while running xamarin.android app

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.

Upvotes: 5

Views: 11074

Answers (10)

Nicol Vishan
Nicol Vishan

Reputation: 63

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

Upvotes: 0

VK Mallaya
VK Mallaya

Reputation: 394

Increase the HeapSize

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

Upvotes: 0

Rahul Baradia
Rahul Baradia

Reputation: 11951

Just resolved my problem by Unchecking Enable Proguard option.

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

Upvotes: -1

Gajendra karn
Gajendra karn

Reputation: 64

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.

Upvotes: 0

Manohar
Manohar

Reputation: 53

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

Upvotes: -1

dstrube
dstrube

Reputation: 177

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.

Upvotes: -1

Korayem
Korayem

Reputation: 12497

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

Upvotes: 5

Le-roy Staines
Le-roy Staines

Reputation: 2057

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.

Upvotes: 1

Jouke van der Maas
Jouke van der Maas

Reputation: 4318

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.

Upvotes: 1

Ranjith Kumar Nagiri
Ranjith Kumar Nagiri

Reputation: 863

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.

Upvotes: 7

Related Questions