Bug 56820 - Xamarin.Android.Common.targets(3,3): Error MSB6006: “java” exited with code 2.
Summary: Xamarin.Android.Common.targets(3,3): Error MSB6006: “java” exited with code 2.
Status: CONFIRMED
Alias: None
Product: Android
Classification: Xamarin
Component: General (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2017-05-24 23:47 UTC by James Clancey
Modified: 2017-06-23 18:39 UTC (History)
2 users (show)

Tags: bb
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 56820 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description James Clancey 2017-05-24 23:47:10 UTC
We should give a better error. when users encounter: Xamarin.Android.Common.targets(3,3): Error MSB6006: “java” exited with code 2.

typically caused by going over the dalvik method limit. Point them to a doc telling them to reduce dependencies or enable mutlidex
Comment 1 Jon Douglas [MSFT] 2017-06-23 18:16:54 UTC
I believe this issue can be solved by resolving the following bug first:

https://bugzilla.xamarin.com/show_bug.cgi?id=55117

Going back to external programs giving an exit code of 0-255, we should be returning an error to MSBuild's Error List that contains actionable steps for the user. Typically to find these actionable steps, the user has to enable diagnostic build output. Here's an example of dx.jar failing similar to what Clancey is reporting:

https://gist.github.com/JonDouglas/73a2562e5a658ed41885904e3385c564

Thus the error message:

1>  trouble writing output: Too many field references: 67288; max is 65536. (TaskId:260)
1>  You may try using --multi-dex option. (TaskId:260)

Should be returned to the user to inform them on an actionable step. We could potentially reword this message to say "Enable Multidex in your Android Options" which they actually have control over.