Xamarin.Droid - Could not load assembly System.Web.Mvc - xamarin

I saw multiples post/question about it on StackOverflow but about ASP.NET
I am getting the following:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'System.Web.Mvc.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x00099] in /Users/builder/data/lanes/5749/9cfa7836/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:229
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00000] in /Users/builder/data/lanes/5749/9cfa7836/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:179
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver, System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x0015c] in <998d78d5ee6d46b491b77aff8eeaf856>:0
at Xamarin.Android.Tasks.ResolveAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver) [0x001c7] in <998d78d5ee6d46b491b77aff8eeaf856>:0 (NightLine.Droid)
Now the interesting point is that my project isn't an ASP.NET project att all x) So first, what the hell?
I did this video: https://channel9.msdn.com/Shows/XamarinShow/Snack-Pack-15-Upgrading-to-XamarinForms-to-NET-Standard
I upgrated the .NET Standard project to 2.0. My Android target is 8.0 and the compiler as well. I tried to upgrade all of my Xamarin.Android.* packages but no success...
Any idea?
Thanks

Related

Internal server error in go daddy in web api application

I am facing a problem i need some help.Problem is that i publish a web application in Godaddy server it is giving internal server error while it is working fine in visual studio and when i go in details of the error it giving fallowing message
Could not load file or assembly 'System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileLoadException: Could not load file or assembly 'System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Stack Trace:
[FileLoadException: Could not load file or assembly 'System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
Prasadseed.WebApiApplication.Application_Start() +0
[HttpException (0x80004005): Could not load file or assembly 'System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +10103347
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +123
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +181
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +228
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +314
[HttpException (0x80004005): Could not load file or assembly 'System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10083568
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +99
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +263
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.3928.0

Assembly signing - Xamarin pcl and UWP app

I am signing both pcl and uwp and getting error:
System.IO.FileLoadException: Could not load file or assembly 'Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
Indeed the assembly Xamarin.Forms.Xaml is not signed (Strong name = false)

Xamarin LinkAssemblies build failure

I'm trying to do a release build of my Xamarin.Android app in Team Services and have got the following error:
The "LinkAssemblies" task failed unexpectedly.
Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could
not resolve reference to 'System.Void.Android.Support.CustomTabs.CustomTabsIntent::LaunchUrl(Android.App.
Activity,Android.Net.Uri)' (defined in assembly
'Microsoft.Azure.Mobile.Client, Version=4.0.1.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35') with scope
'Xamarin.Android.Support.CustomTabs, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null'. When the scope is different from the defining
assembly, it usually means that the type is forwarded. --->
Mono.Cecil.ResolutionException: Failed to resolve System.Void.Android.Support.CustomTabs.CustomTabsIntent::LaunchUrl(Android.App.Activity,Android.Net.Uri)
at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext&
context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
--- End of inner exception stack trace ---
at Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
I can see that it's probably related to the package Microsoft.Azure.Mobile.Client but not sure what I would have to do to resolve it (I'm quite new to Xamarin so not sure what to do with this information).
My minSdkVersion is 21.
Thanks
It looks like the guys of Microsoft.Azure.Mobile.Client package have problems with Android.Support.CustomTabs library. Please refer to the posted issues on github: Issue 364 and Issue 361. It looks like Microsoft.Azure.Mobile.Client version 4.0.0 can be built against Android.Support.CustomTabs version 25.3.1, but Microsoft.Azure.Mobile.Client version 4.0.1 can be built against Android.Support.CustomTabs version 23.3.0.
In my case downgrading nuget package Microsoft.Azure.Mobile.Client from version 4.0.1 to version 4.0.0 helped to build and link my project.

Updating Xamarin studio to Visual Studio 2017 code giving error in Xamarin form Android

After Updating Xamarin studio to Visual Studio 2017 code giving error in Xamarin form Android (IOS code work fine in VS2017) ?
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Error MSB4018: The Resolve Library Project Imports task failed unexpectedly.
This is an unhandled exception from a task -- PLEASE OPEN A BUG AGAINST THE TASK OWNER.
System.IO.FileNotFoundException: Could not load assembly 'Crashlytics.Droid, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Crashlytics.Droid.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x000c2] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:225
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (System.String fullName, Mono.Cecil.ReaderParameters parameters) [0x00001] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:170
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (System.String fullName) [0x00001] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:165
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.GetAssembly (System.String fileName) [0x00001] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:160
at Xamarin.Android.Tasks. Resolve Library Project Imports.Extract (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res, System.Collections.Generic.ICollection1[T] jars, System.Collections.Generic.ICollection1[T] resolvedResourceDirectories, System.Collections.Generic.ICollection1[T] resolvedAssetDirectories, System.Collections.Generic.ICollection1[T] resolvedEnvironments) [0x001f2] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/Resolve Library ProjectImports .cs:197
at Xamarin.Android.Tasks. Resolve Library Project Imports.Execute () [0x000e7] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/Resolve Library Project Imports.cs:76
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x0002a] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/msbuild-15.0/src/XMakeBuildEngine/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:632
at Microsoft.Build.BackEnd.TaskBuilder+d__26.MoveNext () [0x002bf] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/msbuild-15.0/src/XMakeBuildEngine/BackEnd/Components/RequestBuilder/TaskBuilder.cs:787 (MSB4018) (DMS-Live.Droid)

LinkAssemblies task failed

Severity Code Description Project File Line Suppression State
Error The "LinkAssemblies" task failed unexpectedly.
Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata
item 'System.Void Android.Widget.TextView::SetTextAppearance(System.Int32)' (defined in 'Xamarin.Forms.Platform.Android, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null') from 'Xamarin.Forms.Platform.Android, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void Android.Widget.TextView::SetTextAppearance(System.Int32)
at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()
--- End of inner exception stack trace ---
at Xamarin.Android.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() FeedReader.Droid
I am trying to build My Xamarin.Adroid project for release. But i keep getting this error. General consensus on the web is that that my Targeting framework and minimum SDK versions have to be so and so, but I have tried them all to no avail.
Both those SDK's are installed on my machine, I also have the latest preview of Xamarin forms added.
Nothing I am trying seems to work. Any help regarding this would be greatly appreciated.
Thank you in advance.
Looks like the method Android.Widget.TextView::SetTextAppearance(System.Int32) first appeared in API23: M. You'll need to change your compile and/or target versions to point to M.
After updated xamarin version i start getting thi error. Clean project first then build it again. fixed for me. Rebuild not working.

Resources