Bug 44013 - User is getting build error when build android application with Enable Multi-Dex option using latest target framework(Android 7.0)
Summary: User is getting build error when build android application with Enable Multi-...
Status: RESOLVED DUPLICATE of bug 42669
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: unspecified
Hardware: PC Mac OS
: Normal normal
Target Milestone: 7.0 (C8)
Assignee: Jonathan Pryor
Depends on:
Reported: 2016-09-06 11:22 UTC by Danish Akhtar
Modified: 2016-11-17 18:38 UTC (History)
6 users (show)

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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Comment 1 Peter Collins 2016-09-06 12:57:53 UTC
@Danish can you please provide the build output and error message? It looks like there may have been an issue with copy/pasting gists. I suspect this case may be similar to bug #42669.
Comment 3 dean.ellis 2016-09-07 08:25:40 UTC
This looks to me like we need to have JDK 1.8 installed . 

@Danish can you let us know which version of Java you have installed?
Comment 5 Jonathan Pryor 2016-09-07 20:20:28 UTC
Please provide diagnostic build output:


Alternatively, please build via `xbuild` on the command-line:

$ xbuild /t:SignAndroidPackage /v:diag YourProject.csproj > b.txt

then gist the contents of b.txt.

Whatever tool is executing to produce the build error doesn't like JDK 1.8 .class files, and I don't know what tool that is.
Comment 6 Jonathan Pryor 2016-09-07 20:32:23 UTC
Relevant diagnostic build output:

> Task "CreateMultiDexMainDexClassList"
> 	Using task CreateMultiDexMainDexClassList from Xamarin.Android.Tasks.CreateMultiDexMainDexClassList, Xamarin.Android.Build.Tasks, Version=, Culture=neutral, PublicKeyToken=null
> 	CreateMultiDexMainDexClassList
> 	  ClassesOutputDirectory: obj/Debug/android/bin/classes
> 	  JavaLibraries:
> 	    /Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v7.0/mono.android.jar
> 	    /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/android-support-multidex.jar
> 	    /Users/petercollins/.local/share/Xamarin/Xamarin.Android.Support.v4/
> 	    /Users/petercollins/.local/share/Xamarin/Xamarin.Android.Support.v4/
> 	    /Users/petercollins/.local/share/Xamarin/Xamarin.Android.Support.v7.AppCompat/
> 	  MultiDexMainDexListFile: obj/Debug/multidex.keep
> 	  CustomMainDexListFiles:
> 	  ToolExe: mainDexClasses
> 	  ToolPath: /Users/petercollins/Library/Developer/Xamarin/android-sdk-macosx/build-tools/24.0.2//
> 	Tool /Users/petercollins/Library/Developer/Xamarin/android-sdk-macosx/build-tools/24.0.2//mainDexClasses execution started with arguments: --output obj/Debug/multidex.keep '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v7.0/mono.android.jar':'/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/android-support-multidex.jar':'/Users/petercollins/.local/share/Xamarin/Xamarin.Android.Support.v4/':'/Users/petercollins/.local/share/Xamarin/Xamarin.Android.Support.v4/':'/Users/petercollins/.local/share/Xamarin/Xamarin.Android.Support.v7.AppCompat/':'obj/Debug/android/bin/classes' 
> 	Environment variables being passed to the tool:
> 		java_tool_options= -Dfile.encoding=UTF8
> 	Error: Can't read [/Library/Frameworks/Xamarin.Android.framework/Versions/7.0.0-3/lib/xbuild-frameworks/MonoAndroid/v7.0/mono.android.jar] (Can't process class [android/app/ActivityTracker.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7)))
> 	Tool /Users/petercollins/Library/Developer/Xamarin/android-sdk-macosx/build-tools/24.0.2//mainDexClasses execution finished.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: error : Tool exited with code: 10. Output: Error: Can't read [/Library/Frameworks/Xamarin.Android.framework/Versions/7.0.0-3/lib/xbuild-frameworks/MonoAndroid/v7.0/mono.android.jar] (Can't process class [android/app/ActivityTracker.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7)))

(Thanks @PeterC!)

The tool involved is `build-tools/24.0.2/mainDexClasses`, which is a shell script, which invokes *proguard* with the `mainDexClasses.rules` ruleset.


Proguard, as included in the Android SDK, doesn't support Java 1.8: http://stackoverflow.com/questions/24713640/proguard-does-not-support-java-8 (among others).

(I thought we had a bug about that, but I can't find it at present.)
Comment 7 Jonathan Pryor 2016-09-07 20:34:14 UTC
Thanks again to @PeterC for pointing out the "actual" bug: Bug #42669.
Comment 8 Jonathan Pryor 2016-09-07 21:10:33 UTC
Marking as a duplicate of Bug #42669 for now. The problem is that the `proguard` included in the Android SDK doesn't support JDK 1.8 bytecode.

*** This bug has been marked as a duplicate of bug 42669 ***
Comment 9 matt 2016-11-02 18:52:43 UTC

Seeing as we are not authorised to see BUG 42669 and I am having the exact same issue, could someone suggest a workaround / fix please.

Thanks for your help
Comment 10 Tracey 2016-11-08 22:55:16 UTC
I agree with @matt, it would be nice to be able to check the status of the Bug at least...
Comment 11 Jeremy Kolb 2016-11-17 18:38:56 UTC
Note that updating 'Android SDK Tools' will overwrite any custom proguard you may have copied into your SDK.