Can't build on android phone and getting the following errors.

I'm trying to compile my project on my android 8.1 phone but it doesn't build because of 2 errors.
I'm using Visual Studio Community 2017 version 15.8.7.
The project is using Xamarin.Forms version 2.5.0.280555.
I've downloaded all the android SDK's from 6.0 and up.
My PC is running on Windows 10 Pro.

ERROR 1:
Severity Code Description Project File Line Suppression State
Error Could not load file or assembly 'System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) FileName C:\Users\USER.nuget\packages\refit\4.6.30\build\netstandard1.4\refit.targets 29

ERROR 2:
Severity Code Description Project File Line Suppression State
Error The "ResolveLibraryProjectImports" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load assembly 'FileName, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'FileName.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection1 jars, ICollection1 resolvedResourceDirectories, ICollection1 resolvedAssetDirectories, ICollection1 resolvedEnvironments)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() FileName.Android

Answers

  • BillyLiuBillyLiu Member, Xamarin Team Xamurai

    @poolta321

    I think you could try to delete the bin and obj folder and clean and rebuild your project first.
    If it not work, I think there is some error in your xaml page, please check it. Or could you share a basic demo that can reproduce this issue?

  • poolta321poolta321 Member ✭✭

    @BillyLiu

    I tried cleaned my project and tried rebuilding but upon rebuild it gave me these errors:

    ERROR 1:
    Severity Code Description Project File Line Suppression State
    Error Could not load file or assembly 'System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) Filename.iOS

    ERROR 2:
    Severity Code Description Project File Line Suppression State
    Error Could not load file or assembly 'System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) Filename C:\Users\USER.nuget\packages\refit\4.6.30\build\netstandard1.4\refit.targets 29

    ERROR 3:
    Severity Code Description Project File Line Suppression State
    Error The "ResolveLibraryProjectImports" task failed unexpectedly.
    System.IO.FileNotFoundException: Could not load assembly 'Musjroom, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
    File name: 'Filename.dll'
    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName)
    at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection1 jars, ICollection1 resolvedResourceDirectories, ICollection1 resolvedAssetDirectories, ICollection1 resolvedEnvironments)
    at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() Filename.Android

Sign In or Register to comment.