Bug 53432 - Tool exited with code: 2
Summary: Tool exited with code: 2
Status: RESOLVED NORESPONSE
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild (show other bugs)
Version: 7.1 (C9)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2017-03-17 03:23 UTC by Shay
Modified: 2017-10-04 16:27 UTC (History)
4 users (show)

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


Attachments

Description Shay 2017-03-17 03:23:20 UTC
I just encountered this error (see below) after adding another package.
Clean & rebuild doesn't solve the issue.
Where can I add this "--multi-dex" option?


/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Tool exited with code: 2. Output: 
trouble writing output: Too many field references: 67002; max is 65536.
You may try using --multi-dex option.
References by package:
     2 Octane.Xam.VideoPlayer.Android.Widget
     2 android.accounts
    29 android.app
     1 android.content
    31 android.content.pm
    10 android.content.res
     3 android.database
    42 android.graphics
     1 android.graphics.drawable
     2 android.media
     1 android.media.browse
     2 android.net
    25 android.os
     3 android.print
     8 android.runtime
     1 android.support.annotation
  2424 android.support.compat
  2424 android.support.coreui
  2424 android.support.coreutils
  2498 android.support.customtabs
  2424 android.support.design
   103 android.support.design.internal
   694 android.support.design.widget
  2424 android.support.fragment
  2577 android.support.graphics.drawable
  2424 android.support.graphics.drawable.animated
  2424 android.support.mediacompat
  2603 android.support.transition
  2424 android.support.v4
    13 android.support.v4.accessibilityservice
    17 android.support.v4.animation
   886 android.support.v4.app
   112 android.support.v4.content
     1 android.support.v4.content.pm
     1 android.support.v4.content.res
     9 android.support.v4.graphics
    41 android.support.v4.graphics.drawable
     4 android.support.v4.hardware.display
    12 android.support.v4.hardware.fingerprint
    10 android.support.v4.internal.view
   350 android.support.v4.media
   322 android.support.v4.media.session
    10 android.support.v4.net
    19 android.support.v4.os
    63 android.support.v4.print
    10 android.support.v4.provider
    55 android.support.v4.text
     6 android.support.v4.text.util
   118 android.support.v4.util
   434 android.support.v4.view
   138 android.support.v4.view.accessibility
     8 android.support.v4.view.animation
   495 android.support.v4.widget
   603 android.support.v7.app
  2424 android.support.v7.appcompat
  2424 android.support.v7.cardview
     8 android.support.v7.content.res
    88 android.support.v7.graphics
    18 android.support.v7.graphics.drawable
   436 android.support.v7.media
  2424 android.support.v7.mediarouter
  2424 android.support.v7.palette
  2424 android.support.v7.recyclerview
     1 android.support.v7.text
     2 android.support.v7.transition
   124 android.support.v7.util
    77 android.support.v7.view
   249 android.support.v7.view.menu
  1447 android.support.v7.widget
    89 android.support.v7.widget.helper
     1 android.support.v7.widget.util
     6 android.text
     1 android.text.util
     2 android.transition
    13 android.util
    19 android.view
     8 android.view.accessibility
     1 android.view.inputmethod
    15 android.widget
  2418 com.climbtag.climbtag
  2418 com.google.android.gms
    20 com.google.android.gms.actions
    14 com.google.android.gms.ads.identifier
    36 com.google.android.gms.auth.api.signin
     6 com.google.android.gms.auth.api.signin.internal
  2418 com.google.android.gms.base
    94 com.google.android.gms.common
    92 com.google.android.gms.common.api
    41 com.google.android.gms.common.data
    46 com.google.android.gms.common.images
   164 com.google.android.gms.common.internal
     1 com.google.android.gms.common.internal.safeparcel
     4 com.google.android.gms.common.server
    48 com.google.android.gms.common.stats
    24 com.google.android.gms.common.util
    27 com.google.android.gms.dynamic
    18 com.google.android.gms.dynamite
     2 com.google.android.gms.dynamite.descriptors.com.google.android.gms.flags
    16 com.google.android.gms.flags.impl
  2522 com.google.android.gms.gcm
  2464 com.google.android.gms.iid
  1172 com.google.android.gms.internal
     5 com.google.android.gms.location.places
     6 com.google.android.gms.security
  2466 com.google.android.gms.tasks
     1 com.xamarin.forms.platform.android
     2 ffimageloading.cross
     2 ffimageloading.views
     4 java.lang
     7 java.lang.annotation
     1 java.nio
     5 java.util
     2 java.util.concurrent
     2 md5048a04284979bff265231e98628579ce
     2 md511be73e5921422490b8f8bc00c23427c
     2 md51a9cf5d53a8494b386183fd9bb7a129f
     4 md526b7ac14cffc1a788e82c7b73f3add08
    36 md5270abb39e60627f0f200893b490a1ade
     2 md531e46b185997765898cde66852db2a40
     4 md531f8cc8d4d39b2fa02686ee0eb368905
     6 md532e8653917ebe962ea43c07111206276
     8 md53eb3a8989df3118590dcc4e4ef1dde1e
     2 md5413511a2045ce8736c74fdfc5bb05c1c
     4 md54ada4fbe4a5955f6151fa282d30cfc48
     4 md5539939fcd5322368b18e9187b5e77d3d
     2 md5592c9703a29f34e0b28640ada7c4ff83
    16 md559c9aa88ed4ba00f40822d65057599f7
     4 md57e7f66f929d23b17b7be88e2c5a0baea
     2 md588a879adf152f547778e5147cb2024ef
     2 md59cd5ae6924ea1865908f6a4eed48fb35
     4 md59f70a99687498e7ba187118950981d26
    14 md5a104545e4d19c4ffe9ec3d5074a3b979
     2 md5afd03715c12d7cea439a2ca4d0e82348
   160 md5b60ffeb829f638581ab2bb9b1a7f4f3f
     2 md5ba80335519e8bdab05389da8fae7a335
    34 md5c25e555921ab1c976dcce693fa7017e6
     4 md5cb7b6c6da3a4751f097f9c2681d621d4
     2 md5cf6f91d9bcbb245b12b8f240e1ec031d
     2 md5d3266ca695227db39945f1efb2d2b4fa
     2 md5d3faaefeebcb93e0145f431f44dc199e
     4 md5e521f01327eed797431cb38c6cf432a3
     2 md5e55ab16df45b0a7c111e51d413f35949
     4 md5e60ec46d6aacc16b170861b3c3fc6b99
     2 md5ebd2ac6b4f21c1c00eb0c222fea2469b
     6 mono
     1 mono.android
     4 mono.android.accessibilityservice
     2 mono.android.accounts
    12 mono.android.animation
    31 mono.android.app
     2 mono.android.bluetooth
    20 mono.android.content
     2 mono.android.database.sqlite
     6 mono.android.drm
     6 mono.android.gesture
     2 mono.android.graphics
     2 mono.android.graphics.drawable
     8 mono.android.hardware
     2 mono.android.hardware.display
     2 mono.android.hardware.input
     2 mono.android.inputmethodservice
     8 mono.android.location
    60 mono.android.media
    16 mono.android.media.audiofx
     2 mono.android.media.effect
     2 mono.android.media.midi
     2 mono.android.media.session
     2 mono.android.media.tv
     2 mono.android.net
     6 mono.android.net.nsd
     2 mono.android.net.sip
    18 mono.android.net.wifi.p2p
     2 mono.android.nfc
    10 mono.android.os
    10 mono.android.preference
     2 mono.android.renderscript
     6 mono.android.runtime
     6 mono.android.sax
     2 mono.android.speech
     4 mono.android.speech.tts
    10 mono.android.support.design.widget
     2 mono.android.support.transition
     4 mono.android.support.v4.app
     4 mono.android.support.v4.content
     2 mono.android.support.v4.media.session
     2 mono.android.support.v4.os
    18 mono.android.support.v4.view
     4 mono.android.support.v4.view.accessibility
    12 mono.android.support.v4.widget
     6 mono.android.support.v7.app
     2 mono.android.support.v7.graphics
     2 mono.android.support.v7.media
    32 mono.android.support.v7.widget
     2 mono.android.text
     2 mono.android.transition
    72 mono.android.view
     4 mono.android.view.accessibility
     2 mono.android.view.animation
     2 mono.android.view.textservice
     8 mono.android.webkit
    72 mono.android.widget
     2 mono.com.google.android.gms.common.api
     2 mono.com.google.android.gms.common.images
     2 mono.com.google.android.gms.security
     6 mono.com.google.android.gms.tasks
     4 mono.java.lang
     2 mono.java.util
     2 mono.javax.xml.transform
     2 mono.net.hockeyapp.android
  2606 net.hockeyapp.android
     2 net.hockeyapp.android.adapters
    65 net.hockeyapp.android.metrics
    82 net.hockeyapp.android.metrics.model
    79 net.hockeyapp.android.objects
    80 net.hockeyapp.android.tasks
    85 net.hockeyapp.android.utils
    39 net.hockeyapp.android.views
     2 opentk
     2 opentk.platform.android
     2 opentk_1_0
     2 opentk_1_0.platform.android
 (ClimbTag.Droid)



-------

=== Xamarin Studio Business ===

Version 6.2 (build 1821)
Installation UUID: 07360e74-2c80-443b-94a1-6221c776bc97
Runtime:
	Mono 4.8.0 (mono-4.8.0-branch/e4a3cf3) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 408000495

=== NuGet ===

Version: 3.5.0.0

=== Xamarin.Profiler ===

Version: 1.2.0
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.2.1 (11766.1)
Build 8C1002

=== Xamarin.iOS ===

Version: 10.4.0.123 (Xamarin Business)
Hash: 35d1ccd
Branch: cycle9
Build date: 2017-02-16 17:40:00-0500

=== Xamarin.Mac ===

Version: 3.0.0.393 (Xamarin Business)

=== Xamarin Inspector ===

Version: 1.1.2.0
Hash: cdc01b9
Branch: 1.1-release
Build date: Wed, 22 Feb 2017 23:24:11 GMT

=== Xamarin.Android ===

Version: 7.1.0.41 (Xamarin Business)
Android SDK: /Users/shayo/Library/Android/sdk
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)
		7.0   (API level 24)
		7.1   (API level 25)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.3
SDK Build Tools Version: 25.0.1

Java SDK: /usr
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b16, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Build Information ===

Release ID: 602001821
Git revision: d41b6e51f3fa46a1943f2e31a778d28a7c73d069
Build date: 2017-02-17 15:18:19-05
Xamarin addins: 1363a8d943bab7700c93a97474060b6734aa7f94
Build lane: monodevelop-lion-cycle9

=== Operating System ===

Mac OS X 10.12.3
Darwin Shays-MacBook-Pro.local 16.4.0 Darwin Kernel Version 16.4.0
    Thu Dec 22 22:53:21 PST 2016
    root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64
Comment 1 Shay 2017-03-17 03:50:28 UTC
OK. Found the option under the compiler menu.
Enabled it. Also Pro-Guard. Still have the same error.
Solutions?
Comment 2 Bright Lee 2017-04-05 10:02:57 UTC
I had the same issue.
But, enabling multi-dex resolved for me. 

Did you apply option to 'release' as well?

And recent in the Xamarin.Android release note, there are several things to check. 
Did you read it?
Comment 3 Jon Douglas [MSFT] 2017-06-19 19:23:55 UTC
(In reply to Shay from comment #1)
> OK. Found the option under the compiler menu.
> Enabled it. Also Pro-Guard. Still have the same error.
> Solutions?

If you've enabled multidex or proguard, this error should be resolved. You can read a bit more about this on the following bug:

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

If you enabled multidex and still run into this error, something else is going on. We would need a diagnostic build output log to determine what that is.

https://developer.xamarin.com/guides/android/troubleshooting/troubleshooting/#Diagnostic_MSBuild_Output

Proguard can only be run in a "Release" configuration or you can follow the limitations for enabling in "Debug":

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

Either way, one of these options should fix the problem(multidex will allow going over the limit, proguard will shrink), and enabling both should even further fix this problem. We will need more information via the build output log to further diagnose.
Comment 4 Jon Douglas [MSFT] 2017-10-04 16:27:33 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!

Note You need to log in before you can comment on or make changes to this bug.