Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"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.

like image 352
Ranjith Kumar Nagiri Avatar asked Oct 15 '14 14:10

Ranjith Kumar Nagiri


4 Answers

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.

like image 118
Ranjith Kumar Nagiri Avatar answered Nov 20 '22 04:11

Ranjith Kumar Nagiri


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

like image 29
Korayem Avatar answered Nov 20 '22 04:11

Korayem


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.

like image 1
Jouke van der Maas Avatar answered Nov 20 '22 03:11

Jouke van der Maas


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.

like image 1
Le-roy Staines Avatar answered Nov 20 '22 03:11

Le-roy Staines