4

While working on my MonoDroid/Xamarin.Android app, it suddenly stopped building, telling me

"java" exited with code 1.

After turning on normal MSBuild output verbosity, it showed that the error occurred in Xamarin.Android.Common.targets, located in C:\Program Files (x86)\MSBuild\Xamarin\Android. The line (line 988) starts this block of xml:

<CompileToDalvik 
    JavaMaximumHeapSize="$(JavaMaximumHeapSize)"
    JavaOptions="$(JavaOptions)"
    AndroidSdkDirectory="$(_AndroidSdkDirectory)"
    ClassesOutputDirectory="$(IntermediateOutputPath)android\bin\classes"
    JavaSdkDirectory="$(_JavaSdkDirectory)"
    MonoPlatformJarPath="$(MonoPlatformJarPath)"
    JavaSourceFiles="@(AndroidJavaSource)" 
    JavaLibraries="@(AndroidJavaLibrary)"
    LibraryProjectJars="$(IntermediateOutputPath)__library_projects__\*.jar"
UseDx="$(UseDx)"
/>

Also, when I have the above file open, I have 53 warnings, all similar to:

The element 'PropertyGroup' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element 'ResolveReferencesDependsOn' in namespace 
'http://schemas.microsoft.com/developer/msbuild/2003'. List of possible elements expected: 'Property, AllowUnsafeBlocks, ... [followed by a long list of elements]

I deleted all the code that I had recently added, then ended up doing a full revert to previous code that worked, but the error continues no matter what I do. I found a resolved bug that may occur on the same line, but the solution given there didn't work for me. Also, because of the warnings and the fact that my code used to work it its current revision, it doesn't seem to be the same problem. Any ideas why this would happen, and how I might fix it?

More details: I tried running a new M4A project and it worked fine, so it looks like it isn't a problem with the M4A file, but something my code.

Even more details: I was going through each class, commenting them out to see if I could find a particular block that was causing the problem, when the error suddenly changed. It now displays an error identical to the one found in this question. I am also using the 30-day trial. However, I am using Visual Studio. I'll be seeing if the answer and comments there will help me too.

Community
  • 1
  • 1
ZAD-Man
  • 1,328
  • 23
  • 42
  • I am getting the exact same :/ –  Jul 29 '13 at 11:21
  • Did any of you find a solution ? I'm facing the same situation... Thanks guys. – Nate B. Aug 07 '13 at 06:53
  • It went away for me for no apparent reason. I really wish I could help you guys out, but I have no idea what changed. I just banged my head against the wall for a few days and suddenly it was working again. – ZAD-Man Aug 07 '13 at 21:14
  • @ZAD-MAn Will do but wont be for a couple days as the whole process takes hours! –  Aug 12 '13 at 10:45
  • Getting same error too :( Seems to have started happening after downloading and installing the new Xamarin.Android. Not sure if it's a problem with the new release specifically, or that updating an existing version messed something up. – deadlydog Aug 12 '13 at 21:04
  • Just saw your last few lines about you are using the 30-day trial. That is very interesting, as this worked fine for me when using my paid account, but after doing the updates for Xamarin.Android and Xamarin.iOS and specifying to use the 30-day free trial for Xamarin.iOS (as I don't have a license for that yet) I started getting this error (but my Xamarin.Android project is the one throwing the error). So I wonder if it has something to do with using the trial version of Xamarin? – deadlydog Aug 14 '13 at 06:39
  • Just bought and activated the Xamarin.iOS license, but the problem continues, so if this problem is caused by using the 30-day free trial, buying a license doesn't fix it. – deadlydog Aug 16 '13 at 02:57
  • Very strange, I hadn't made any code changes at all, but I am not able to build the solution successfully in Visual Studio; however it still fails with the same error message when I build it from my build scripts (i.e. calling MSBuild.exe from the command line). – deadlydog Aug 30 '13 at 05:34
  • @deadlydog Dang, weird. Thanks for posting the updates though. I'm starting to wish I worked on the inside so I could figure out what's going on behind the scenes... – ZAD-Man Aug 30 '13 at 18:33
  • idem, after deleting all bin/obj folders, java still exits with code 1. And my Xamarin subscriptions are valids. – Nate B. Sep 03 '13 at 09:34
  • So while it was working earlier, it randomly decided to start giving me this error when building in Visual Studio again :( The good news is that I emailed Xamarin support and they are going to investigate the issue. I sent them a sample project that reproduces the issue for me (the DPSF Demo Source Code actually - http://www.xnaparticles.com/Download.php); not sure if it will barf for them too though, since it may be a machine-specific problem. I'll keep you updated. – deadlydog Sep 09 '13 at 21:02
  • You can follow the Xamarin Bug submission at https://bugzilla.xamarin.com/show_bug.cgi?id=14579. The help desk also mentioned 2 other submitted bugs that report the same error message, and may or may not be related. https://bugzilla.xamarin.com/show_bug.cgi?id=4288 and https://bugzilla.xamarin.com/show_bug.cgi?id=14363 – deadlydog Sep 10 '13 at 17:46

4 Answers4

0

I had the same problem and solved it by deleting my entire solution an pulling it from source control again. If you do not have a source to pull from, then i suggest deleting all generated files such as the contents of bin and debug folders.

  • I tried deleting all bin and obj folders, but still same thing. I haven't tried deleting and re-pulling from source control yet though. – deadlydog Aug 12 '13 at 19:43
  • Downloaded project from source control into a new directory and compiled, same error :( – deadlydog Aug 12 '13 at 21:02
0

Yes It's a good solution I have removed same problem from my project. Step that you have need

1. Delete Bin and obj folder from project
2. Delete Solution File From Project Folder
3. Open New Visual Studio and then Click File > Open > Project/Solution >
   Select Folder Where placed you project.
   and after all, Rebuild Solution file and then rebuild your project.

I am sure u will success about this problem.....

Deepak
  • 6,684
  • 18
  • 69
  • 121
0

I encountered this problem on a colleague's computer. 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.

Jouke van der Maas
  • 4,117
  • 2
  • 28
  • 35
0

I have solved by disabling the Proguard option and able to build it.

Right Click on Project -> Click Properties -> Android Options -> Uncheck Checkbox of Enable Proguard. 
Rahul Baradia
  • 11,802
  • 17
  • 73
  • 121