出了什么问题?
我从GCM升级到FCM。新的Firebase依赖关系为Dex文件添加了太多内容。因此,我必须启用Proguard / MultiDex。 Android发布版本运行良好,没有错误或警告。但是,当我存档发布时,程序包创建将失败,并显示以下错误:
The "LinkAssemblies" task failed unexpectedly.
error MSB4018: System.ArgumentException: An item with the same key has already been added. Key: <>PropertyChangedEventArgs
这是完整的跟踪记录:
Target _LinkAssembliesShrink:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: The "LinkAssemblies" task failed unexpectedly.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: System.ArgumentException: An item with the same key has already been added. Key: <>PropertyChangedEventArgs
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x0015a] in <b4d1a66727f44ba888b54966284fabb4>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <b4d1a66727f44ba888b54966284fabb4>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at System.Linq.Enumerable.ToDictionary[TSource,TKey] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x0007c] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq/src/System/Linq/ToCollection.cs:71
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at System.Linq.Enumerable.ToDictionary[TSource,TKey] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq/src/System/Linq/ToCollection.cs:34
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at MonoDroid.Tuner.MarkJavaObjects.GetTypesInModule (Mono.Cecil.ModuleDefinition module) [0x00006] in <f75400f667544646a4fe83f8dcfa565c>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at MonoDroid.Tuner.MarkJavaObjects.FindType (Mono.Cecil.TypeDefinition type, System.String fullname) [0x0001b] in <f75400f667544646a4fe83f8dcfa565c>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at MonoDroid.Tuner.MarkJavaObjects.GetHelperType (Mono.Cecil.TypeDefinition type, System.String suffix) [0x00042] in <f75400f667544646a4fe83f8dcfa565c>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at MonoDroid.Tuner.MarkJavaObjects.PreserveHelperType (Mono.Cecil.TypeDefinition type, System.String suffix) [0x00000] in <f75400f667544646a4fe83f8dcfa565c>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at MonoDroid.Tuner.MarkJavaObjects.PreserveAdapter (Mono.Cecil.TypeDefinition type) [0x00000] in <f75400f667544646a4fe83f8dcfa565c>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at MonoDroid.Tuner.MarkJavaObjects.PreserveJavaObjectImplementation (Mono.Cecil.TypeDefinition type) [0x0000e] in <f75400f667544646a4fe83f8dcfa565c>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at MonoDroid.Tuner.MarkJavaObjects.ProcessType (Mono.Cecil.TypeDefinition type) [0x00009] in <f75400f667544646a4fe83f8dcfa565c>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at Mono.Tuner.SubStepDispatcher.DispatchType (Mono.Cecil.TypeDefinition type) [0x0002d] in <f75400f667544646a4fe83f8dcfa565c>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at Mono.Tuner.SubStepDispatcher.BrowseTypes (System.Collections.ICollection types) [0x00018] in <f75400f667544646a4fe83f8dcfa565c>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at Mono.Tuner.SubStepDispatcher.BrowseAssemblies (System.Collections.Generic.IEnumerable`1[T] assemblies) [0x0003f] in <f75400f667544646a4fe83f8dcfa565c>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at Mono.Tuner.SubStepDispatcher.Process (Mono.Linker.LinkContext context) [0x0000e] in <f75400f667544646a4fe83f8dcfa565c>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x0001c] in <f75400f667544646a4fe83f8dcfa565c>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at MonoDroid.Tuner.Linker.Run (Mono.Linker.Pipeline pipeline, Mono.Linker.LinkContext context) [0x00000] in <f75400f667544646a4fe83f8dcfa565c>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at MonoDroid.Tuner.Linker.Process (MonoDroid.Tuner.LinkerOptions options, Mono.Linker.ILogger logger, Mono.Linker.LinkContext& context) [0x00071] in <f75400f667544646a4fe83f8dcfa565c>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x002d4] in <f75400f667544646a4fe83f8dcfa565c>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute () [0x0001b] in <f75400f667544646a4fe83f8dcfa565c>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:573
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2193,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x001f6] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:784
Done building target "_LinkAssembliesShrink" in project "Messenger.Droid.csproj" -- FAILED.
什么环境?
我使用Visual Studio for Mac v8.0.4
这是我的Proguard配置:
-dontobfuscate
-adaptresourcefilecontents **.properties,META-INF/MANIFEST.MF
# AppCenter Push
-dontwarn com.microsoft.appcenter.**
-dontwarn com.google.android.gms.**
-keep class com.google.firebase.provider.FirebaseInitProvider
-keep class com.google.firebase.iid.FirebaseInstanceIdReceiver
-keep class com.google.firebase.messaging.FirebaseMessagingService
# Okio
-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**
和包装:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Fody" version="5.0.0" targetFramework="monoandroid90" developmentDependency="true" />
<package id="Microsoft.AppCenter" version="1.14.0" targetFramework="monoandroid90" />
<package id="Microsoft.AppCenter.Analytics" version="1.14.0" targetFramework="monoandroid90" />
<package id="Microsoft.AppCenter.Crashes" version="1.14.0" targetFramework="monoandroid90" />
<package id="Microsoft.AppCenter.Push" version="1.14.0" targetFramework="monoandroid90" />
<package id="Microsoft.CSharp" version="4.5.0" targetFramework="monoandroid90" />
<package id="Microsoft.NETCore.Platforms" version="2.2.0" targetFramework="monoandroid90" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="monoandroid90" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="monoandroid90" />
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="monoandroid90" />
<package id="Plugin.CurrentActivity" version="2.1.0.4" targetFramework="monoandroid90" />
<package id="PropertyChanged.Fody" version="2.6.1" targetFramework="monoandroid90" />
<package id="System.AppContext" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Collections" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.ComponentModel.TypeConverter" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Console" version="4.3.1" targetFramework="monoandroid90" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Globalization" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Globalization.Calendars" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Linq" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Net.Http" version="4.3.4" targetFramework="monoandroid90" />
<package id="System.Net.Primitives" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Net.Sockets" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="monoandroid90" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Reflection" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Runtime" version="4.3.1" targetFramework="monoandroid90" />
<package id="System.Runtime.Extensions" version="4.3.1" targetFramework="monoandroid90" />
<package id="System.Runtime.Handles" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Runtime.Serialization.Formatters" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Runtime.Serialization.Primitives" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="monoandroid90" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Threading" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Threading.Timer" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Xml.ReaderWriter" version="4.3.1" targetFramework="monoandroid90" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="monoandroid90" />
<package id="System.Xml.XmlDocument" version="4.3.0" targetFramework="monoandroid90" />
<package id="Xam.Plugin.DeviceInfo" version="4.1.1" targetFramework="monoandroid90" />
<package id="Xam.Plugin.WebView" version="2.1.3" targetFramework="monoandroid90" />
<package id="Xam.Plugins.Settings" version="3.1.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Arch.Core.Common" version="1.1.1.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Arch.Core.Runtime" version="1.1.1.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Arch.Lifecycle.Common" version="1.1.1.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Arch.Lifecycle.LiveData" version="1.1.1.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Arch.Lifecycle.LiveData.Core" version="1.1.1.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Arch.Lifecycle.Runtime" version="1.1.1.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Arch.Lifecycle.ViewModel" version="1.1.1.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.Annotations" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.AsyncLayoutInflater" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.Collections" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.Compat" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.CoordinaterLayout" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.Core.UI" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.Core.Utils" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.CursorAdapter" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.CustomTabs" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.CustomView" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.Design" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.DocumentFile" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.DrawerLayout" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.Fragment" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.Interpolator" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.Loader" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.LocalBroadcastManager" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.Media.Compat" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.Print" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.SlidingPaneLayout" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.SwipeRefreshLayout" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.Transition" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.v4" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.v7.AppCompat" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.v7.CardView" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.v7.MediaRouter" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.v7.Palette" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.v7.RecyclerView" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.Vector.Drawable" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.VersionedParcelable" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Android.Support.ViewPager" version="28.0.0.1" targetFramework="monoandroid90" />
<package id="Xamarin.Build.Download" version="0.4.11" targetFramework="monoandroid90" />
<package id="Xamarin.Essentials" version="1.1.0" targetFramework="monoandroid90" />
<package id="Xamarin.Firebase.Common" version="60.1142.1" targetFramework="monoandroid90" />
<package id="Xamarin.Firebase.Iid" version="60.1142.1" targetFramework="monoandroid90" />
<package id="Xamarin.Firebase.Messaging" version="60.1142.1" targetFramework="monoandroid90" />
<package id="Xamarin.Forms" version="3.6.0.344457" targetFramework="monoandroid90" />
<package id="Xamarin.GooglePlayServices.Basement" version="60.1142.1" targetFramework="monoandroid90" />
<package id="Xamarin.GooglePlayServices.Tasks" version="60.1142.1" targetFramework="monoandroid90" />
</packages>
问题:有人知道如何解决构建问题吗?或者如何调试并找到此“具有相同键的项目”?