AndroidX: Can't build in Release: Xamarin.AndroidX.Migration.targets(227,9): error : Symbols were found but are not matching the assembly

Xamarin.Android Version (eg: 6.0):

Operating System & Version (eg: Mac OSX 10.11):

MacOS 10.15.3

Support Libraries Version (eg: 23.3.0):

=== Visual Studio Community 2019 for Mac (Preview) ===

Version 8.5 Preview (8.5 build 3178) Installation UUID: 33ba9349-a2e6-4f41-b8f4-0ead5fc49e6e GTK+ 2.24.23 (Raleigh theme) Xamarin.Mac 6.14.1.39 (d16-5 / 30e8706b4)

Package version: 608000123

=== Mono Framework MDK ===

Runtime: Mono 6.8.0.123 (2019-10/1d0d939dc30) (64-bit) Package version: 608000123

=== Xamarin Designer ===

Version: 16.5.0.471 Hash: 35aa4889d Branch: remotes/origin/d16-5 Build date: 2020-02-25 00:52:08 UTC

=== Roslyn (Language Service) ===

3.5.0-beta4-20125-04+1baa0b3063238ed752ad1f0368b1df6b6901373e

=== NuGet ===

Version: 5.4.0.6315

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/3.1.200/Sdks SDK Versions: 3.1.200 3.1.102 3.1.101 3.1.100 3.0.101 3.0.100 2.1.701 2.1.700 2.1.505 2.1.504 2.1.503 2.1.302 2.1.301 2.1.4 2.0.0 MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.8.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 3.1.2 3.1.1 3.1.0 3.0.1 3.0.0 2.1.16 2.1.15 2.1.14 2.1.13 2.1.12 2.1.11 2.1.9 2.1.8 2.1.7 2.1.2 2.1.1 2.0.5 2.0.0

=== Xamarin.Profiler ===

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

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 11.3.1 (15715) Build 11C504

=== Xamarin.Mac ===

Version: 6.14.1.39 (Visual Studio Community) Hash: 30e8706b4 Branch: d16-5 Build date: 2020-02-20 16:41:47-0500

=== Xamarin.iOS ===

Version: 13.14.1.39 (Visual Studio Community) Hash: 30e8706b4 Branch: d16-5 Build date: 2020-02-20 16:41:48-0500

=== Xamarin.Android ===

Version: 10.2.0.100 (Visual Studio Community) Commit: xamarin-android/d16-5/988c811 Android SDK: /Users/admin/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 7.1 (API level 25) 8.1 (API level 27)

SDK Tools Version: 26.1.1 SDK Platform Tools Version: 29.0.6 SDK Build Tools Version: 29.0.2

Build Information: Mono: c0c5c78 Java.Interop: xamarin/java.interop/d16-5@fc18c54 ProGuard: xamarin/proguard/master@905836d SQLite: xamarin/sqlite/3.28.0@46204c4 Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-5@9f4ed4b

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/admin/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_8.0.25 1.8.0-25 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.5.0.39 Hash: 6fb4c79 Branch: remotes/origin/d16-5 Build date: 2020-02-20 23:25:56 UTC

=== Android Device Manager ===

Version: 16.5.0.71 Hash: 49194e8 Branch: remotes/origin/d16-5 Build date: 2020-02-20 23:26:18 UTC

=== Xamarin Inspector ===

Version: 1.4.3 Hash: db27525 Branch: 1.4-release Build date: Mon, 09 Jul 2018 21:20:18 GMT Client compatibility: 1

=== Build Information ===

Release ID: 805003178 Git revision: bc5bb028e622b0bf8cd8eb52fd97add17f20c9ca Build date: 2020-03-18 15:20:43-04 Build branch: release-8.5 Xamarin extensions: bc5bb028e622b0bf8cd8eb52fd97add17f20c9ca

=== Operating System ===

Mac OS X 10.15.3 Darwin 19.3.0 Darwin Kernel Version 19.3.0 Thu Jan 9 20:58:23 PST 2020 root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64

Describe your Issue:

Please see below stacktrace

Steps to Reproduce (with link to sample solution if possible):

Below is the packages I have in my Android csproj project:

  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{43094198-9F89-4143-ACC7-F4A1BE97CB05}</ProjectGuid>
    <ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <OutputType>Library</OutputType>
    <RootNamespace></RootNamespace>
    <AssemblyName></AssemblyName>
    <AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
    <AndroidApplication>true</AndroidApplication>
    <ProductVersion>8.0.30703</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <FileAlignment>512</FileAlignment>
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
    <AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
    <TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
    <AndroidStoreUncompressedFileExtensions />
    <MandroidI18n />
    <JavaMaximumHeapSize>4G</JavaMaximumHeapSize>
    <JavaOptions />
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
    <AndroidEnableMultiDex>true</AndroidEnableMultiDex>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
    <AndroidLinkMode>None</AndroidLinkMode>
    <AndroidSupportedAbis>armeabi-v7a;x86</AndroidSupportedAbis>
    <AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
    <JavaMaximumHeapSize>4G</JavaMaximumHeapSize>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>RELEASE;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
    <AndroidLinkMode>SdkOnly</AndroidLinkMode>
    <JavaMaximumHeapSize>8G</JavaMaximumHeapSize>
    <AotAssemblies>true</AotAssemblies>
    <EnableLLVM>true</EnableLLVM>
    <BundleAssemblies>true</BundleAssemblies>
    <AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
    <AndroidSupportedAbis>armeabi-v7a;arm64-v8a</AndroidSupportedAbis>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Mono.Android" />
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.IO.Compression" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Json" />
    <Reference Include="Java.Interop" />
    <Reference Include="System.Collections" />
    <Reference Include="System.IdentityModel" />
    <Reference Include="System.Runtime" />
    <Reference Include="System.Runtime.Serialization" />
    <Reference Include="System.Threading.Tasks" />
    <Reference Include="System.Numerics" />
    <Reference Include="System.Numerics.Vectors" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="CarouselView.FormsPlugin" Version="5.2.0" />
    <PackageReference Include="Microsoft.AppCenter.Crashes">
      <Version>3.0.0</Version>
    </PackageReference>
    <PackageReference Include="Microsoft.AppCenter.Analytics">
      <Version>3.0.0</Version>
    </PackageReference>
    <PackageReference Include="Plugin.CurrentActivity" Version="2.1.0.4" />
    <PackageReference Include="SQLiteNetExtensions.Async">
      <Version>2.1.0</Version>
    </PackageReference>
    <PackageReference Include="Syncfusion.Xamarin.SfPicker" Version="17.4.0.55" />
    <PackageReference Include="Syncfusion.Xamarin.SfChart" Version="17.4.0.55" />
    <PackageReference Include="Syncfusion.Xamarin.SfListView" Version="17.4.0.55" />
    <PackageReference Include="Xamarin.Essentials" Version="1.5.1" />
    <PackageReference Include="Xamarin.FFImageLoading.Forms" Version="2.4.11.982" />
    <PackageReference Include="Xamarin.Forms" Version="4.5.0.396" />
    <PackageReference Include="Xamarin.GooglePlayServices.Ads.Lite" Version="71.1720.1" />
    <PackageReference Include="Plugin.InAppBilling">
      <Version>2.0.0</Version>
    </PackageReference>
    <PackageReference Include="AndHUD">
      <Version>1.4.2</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.AndroidX.Work.Runtime">
      <Version>2.3.3</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.AndroidX.Migration">
      <Version>1.0.1</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.AndroidX.AppCompat">
      <Version>1.1.0</Version>
    </PackageReference>
</ItemGroup>

Include any relevant Exception Stack traces, build logs, adb logs:

Target _AndroidXCecilfy:
    Migrated assembly to 'obj/Release/androidx/cecil/CarouselView.FormsPlugin.Android.dll'.
    Migrated assembly to 'obj/Release/androidx/cecil/Com.Android.DeskClock.dll'.
    Migrated assembly to 'obj/Release/androidx/cecil/Com.ViewPagerIndicator.dll'.
    Migrated assembly to 'obj/Release/androidx/cecil/Syncfusion.SfListView.XForms.Android.dll'.
    Migrated assembly to 'obj/Release/androidx/cecil/Xamarin.GooglePlayServices.Basement.dll'.
    /Users/admin/.nuget/packages/xamarin.androidx.migration/1.0.1/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error : Symbols were found but are not matching the assembly
    /Users/admin/.nuget/packages/xamarin.androidx.migration/1.0.1/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error :   at Mono.Cecil.ModuleDefinition.ReadSymbols (Mono.Cecil.Cil.ISymbolReader reader, System.Boolean throwIfSymbolsAreNotMaching) [0x0003c] in <1b16609822914d769fb771c1bb74cd3b>:0 
    /Users/admin/.nuget/packages/xamarin.androidx.migration/1.0.1/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error :   at Mono.Cecil.ModuleReader.ReadSymbols (Mono.Cecil.ModuleDefinition module, Mono.Cecil.ReaderParameters parameters) [0x00060] in <1b16609822914d769fb771c1bb74cd3b>:0 
    /Users/admin/.nuget/packages/xamarin.androidx.migration/1.0.1/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error :   at Mono.Cecil.ModuleReader.CreateModule (Mono.Cecil.PE.Image image, Mono.Cecil.ReaderParameters parameters) [0x00081] in <1b16609822914d769fb771c1bb74cd3b>:0 
    /Users/admin/.nuget/packages/xamarin.androidx.migration/1.0.1/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error :   at Mono.Cecil.ModuleDefinition.ReadModule (Mono.Disposable`1[T] stream, System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0000d] in <1b16609822914d769fb771c1bb74cd3b>:0 
    /Users/admin/.nuget/packages/xamarin.androidx.migration/1.0.1/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error :   at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0006c] in <1b16609822914d769fb771c1bb74cd3b>:0 
    /Users/admin/.nuget/packages/xamarin.androidx.migration/1.0.1/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error :   at Mono.Cecil.AssemblyDefinition.ReadAssembly (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <1b16609822914d769fb771c1bb74cd3b>:0 
    /Users/admin/.nuget/packages/xamarin.androidx.migration/1.0.1/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error :   at Xamarin.AndroidX.Migration.CecilMigrator.Migrate (System.String source, System.String destination) [0x001c2] in <a0fc649a8e4a40aab84691110eb542cb>:0 
    /Users/admin/.nuget/packages/xamarin.androidx.migration/1.0.1/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error :   at Xamarin.AndroidX.Migration.CecilMigrator.Migrate (System.Collections.Generic.IEnumerable`1[T] assemblies) [0x00012] in <a0fc649a8e4a40aab84691110eb542cb>:0 
    /Users/admin/.nuget/packages/xamarin.androidx.migration/1.0.1/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error :   at Xamarin.AndroidX.Migration.BuildTasks.CecilfyFiles.Execute () [0x000e3] in <1b449a83137d4707a3ad83671affa396>:0 

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 36 (8 by maintainers)

Commits related to this issue

Most upvoted comments

If I upgrade Xamarin.AndroidX.Legacy.Support.V4 from 1.0.0.1 to 1.0.0.3 then I have an error while compiling because Mono.Cecil or some dependency is missing. Even updating Xamarin.AndroidX.Migration before other packages the error remains

I have the same issue

Thanks @mark74 for feedback

Had the same issue this morning…on an older solution. I had a more recent project I was working on, that did not have the issue, so I decided to compare Android project files to see if I could see any differences. Seems my old solution had a LOT of extra Android packages that the new solution did not include, so I backed up the old Android project file and removed the extra Xamarin.Android files, and it worked!

Old Android project file had these lines:

<PackageReference Include="Xamarin.AndroidX.MediaRouter"> <Version>1.1.0.2</Version> </PackageReference> <PackageReference Include="Xamarin.Android.Support.ViewPager" Version="28.0.0.3" /> <PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.3" /> <PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.3" /> <PackageReference Include="Xamarin.Android.Support.v4" Version="28.0.0.3" /> <PackageReference Include="Xamarin.Android.Support.v7.CardView" Version="28.0.0.3" /> <PackageReference Include="Xamarin.Android.Support.v7.MediaRouter" Version="28.0.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.3" /> <PackageReference Include="Xamarin.Android.Support.CustomTabs" Version="28.0.0.3" /> <PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" /> <PackageReference Include="Xamarin.Forms"> <Version>4.8.0.1269</Version> </PackageReference> <PackageReference Include="Xamarin.Forms.Visual.Material"> <Version>4.8.0.1269</Version> </PackageReference>

Which I reduced to <PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" /> <PackageReference Include="Xamarin.Forms"> <Version>4.8.0.1269</Version> </PackageReference> <PackageReference Include="Xamarin.Forms.Visual.Material"> <Version>4.8.0.1269</Version> </PackageReference>

I now believe this bug happens when you have both

<TargetFrameworkVersion>v10.0</TargetFrameworkVersion>

and dependencies on Support libraries. Originally I thought my other project (let’s call B) must not have certain dependencies that this one (A) has. But after changing TargetFrameworkVersion, that one starts asking for direct AndroidX referencing as well and fails like this.

Xamarin.Android.Support.v7.AppCompat doesn’t affect project B. I have SyncFusion and it requires direct reference of Xamarin.Android.Support.v7.AppCompat and everything works.

I also notices that if I have any dependencies on Support libraries, I can’t add direct reference of AndroidX libraries, e.g. Work. The build will start asking for a bunch of other AndroidX libraries and then ultimately fail

Guys, in fact I cannot reproduce this problem any more, after I wiped out all obj/ and bin/ directories. Earlier, I only used “Clean All” in VS, but apparently that does not clean up everything.

I see exactly the same error here. I can build my project well in Debug mode, but in Release I get:

Target _AndroidXCecilfy:
    Migrated assembly to 'obj/Release/androidx/cecil/WhatsThisDrone.Android.dll'.
    /Users/janus/.nuget/packages/xamarin.androidx.migration/1.0.0/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error : Symbols were found but are not matching the assembly
    /Users/janus/.nuget/packages/xamarin.androidx.migration/1.0.0/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error :   at Mono.Cecil.ModuleDefinition.ReadSymbols (Mono.Cecil.Cil.ISymbolReader reader, System.Boolean throwIfSymbolsAreNotMaching) [0x0003c] in <1b16609822914d769fb771c1bb74cd3b>:0 
    /Users/janus/.nuget/packages/xamarin.androidx.migration/1.0.0/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error :   at Mono.Cecil.ModuleReader.ReadSymbols (Mono.Cecil.ModuleDefinition module, Mono.Cecil.ReaderParameters parameters) [0x00060] in <1b16609822914d769fb771c1bb74cd3b>:0 
    /Users/janus/.nuget/packages/xamarin.androidx.migration/1.0.0/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error :   at Mono.Cecil.ModuleReader.CreateModule (Mono.Cecil.PE.Image image, Mono.Cecil.ReaderParameters parameters) [0x00081] in <1b16609822914d769fb771c1bb74cd3b>:0 
    /Users/janus/.nuget/packages/xamarin.androidx.migration/1.0.0/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error :   at Mono.Cecil.ModuleDefinition.ReadModule (Mono.Disposable`1[T] stream, System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0000d] in <1b16609822914d769fb771c1bb74cd3b>:0 
    /Users/janus/.nuget/packages/xamarin.androidx.migration/1.0.0/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error :   at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0006c] in <1b16609822914d769fb771c1bb74cd3b>:0 
    /Users/janus/.nuget/packages/xamarin.androidx.migration/1.0.0/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error :   at Mono.Cecil.AssemblyDefinition.ReadAssembly (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <1b16609822914d769fb771c1bb74cd3b>:0 
    /Users/janus/.nuget/packages/xamarin.androidx.migration/1.0.0/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error :   at Xamarin.AndroidX.Migration.CecilMigrator.Migrate (System.String source, System.String destination) [0x001c2] in <d7fed48e09644e5387b3c96b5e241b74>:0 
    /Users/janus/.nuget/packages/xamarin.androidx.migration/1.0.0/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error :   at Xamarin.AndroidX.Migration.CecilMigrator.Migrate (System.Collections.Generic.IEnumerable`1[T] assemblies) [0x00012] in <d7fed48e09644e5387b3c96b5e241b74>:0 
    /Users/janus/.nuget/packages/xamarin.androidx.migration/1.0.0/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error :   at Xamarin.AndroidX.Migration.BuildTasks.CecilfyFiles.Execute () [0x000e3] in <6e09a813e9e049ef988e9067c8e74b4c>:0 

IIRC this happens since upgrading to Xamarin.Essentials 1.5, which depends on AndroidX. What I find strange is that the above error mentions monoandroid90, although I’m targeting Android 10.

I have similar error when building in App Center, what is odd I can build release version in Visual Studio without problems. Let me know if you got any solution.