Trying to use PCL for mvvmcross with TPL by Profile 78
(regarding question TPL on PCL of mvvmcross)
On iOS project it's working, but NOT for android.
here the Error:
Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.Perhaps it doesn't exist in the Mono for Android profile? File name: 'System.Runtime.dll' at Xamarin.Android.Tuner.DirectoryAssemblyResolve
So,
does anyone know how to use Profile 78 with android
(or other profile to work with that includes TPL) ?
We're using Profile111 and Profile259 (on different projects) with MvvmCross.
Related
I am working on an app and want to bind the Image URL in image view of recycler i want to use picaso for this but every time when I add nuget package I'll got an error.
System.IO.FileNotFoundException: Could not load assembly 'Square.OkHttp, Version=2.7.5.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
Please suggest
It's displaying the error because it requires the add-on libraries OkHttp and OkIO. Add the package for Picasso and try again.
I am trying to POST data using a REST API. The app used to run flawlessly, but now that I've added code to perform the POST, I'm getting a new error. Would anyone be able to help explain what's going wrong and suggest an alternative that would let me complete the POST request successfully?
Here's the error I get when I try to build the app with the linker enabled in the Release configuration:
Error The "LinkAssemblies" task failed unexpectedly.
Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata item 'System.Runtime.InteropServices.StandardOleMarshalObject' (defined in 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089') from 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed to resolve System.Runtime.InteropServices.StandardOleMarshalObject
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.InitializeType(TypeDefinition type)
at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.MarkStep.Initialize()
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() GimcoIOT.Andriod
It looks like you might have added a reference to a desktop .NET assembly in your Xamarin.Android app. The System.Windows.Forms namespace is not available in the Xamarin.Android profile. (Even if the app builds successfully when you disable linking, it will in theory still fail at run time any time it tries to run code that references the System.Windows.Forms namespace.)
To solve this problem, you will want to remove the reference to the desktop .NET assembly from your Xamarin.Android project and ensure that all of your other referenced assemblies are compiled either against the Xamarin.Android profile or a supported PCL profile.
As mentioned in the documentation:
Xamarin.Android is not ABI compatible with existing assemblies compiled for a different profile. You must recompile your source code to generate assemblies targeting the Xamarin.Android profile (just as you need to recompile source code to target Silverlight and .NET 3.5 separately).
(Portable Class Libraries are the special exception to this rule.)
If you are currently using a type from the System.Windows.Forms namespace to perform the POST request, then you will need to switch to a different type. For example, one of the PostAsync() methods from System.Net.Http.HttpClient might work nicely.
I have a multiplatform app using Xamarin.Forms. While I can build for iOS and WindowsPhone 8.1, when I build for Android, I get the following build error
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: error : Error executing task LinkAssemblies: error XA2006: Reference to metadata item 'System.Void Android.OS.BaseBundle::PutString(System.String,System.String)' (defined in 'XLabs.Platform.Droid, Version=2.0.5679.29813, Culture=neutral, PublicKeyToken=null') from 'XLabs.Platform.Droid, Version=2.0.5679.29813, Culture=neutral, PublicKeyToken=null' could not be resolved.
I've searched around for a solution on this but cannot seem to find one or where on earth in my code this problem is coming from.
Does anyone know how to start solving this issue so I can submit a build?
Check that the Xamarin Forms NuGet package versions are the same in the XLabs version you are using and the Android Project. Normally a version mismatch is the cause for these errors.
I have referenced HttpStatusCode via System.Net in a Portable Class Library.
I then need to reference that status code from a MonoDroid project that includes that PCL. I understand that the System.Net namespace exists in the System DLL for MonoDroid and this has been included.
However this results in a build error:
CS0012: The type 'System.Net.HttpStatusCode' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.
Now I realise there are strong namespacing issues with referencing the PCL System.Net, and that there is a Shim DLL in MvvmCross.PortableSupport that is supposed to resolve this issue. I have included MvvmCross.PortableSupport.3.0.8.1\lib\MonoAndroid16\System.Net.dll to the MonoDroid project, but I still get the same error.
What am I missing?
Thanks!
Matthew
So I was unable to determine the underlying issue, but the workaround was to avoid referencing the System.Net symbol from the native code via the Portable Class Library (framework 104 btw)
In this instance, instead of exposing the HttpStatusCode from the PCL, I exposed it as an integer and thus worked around the problem.
Stuart is away on holiday at the moment but he suggested this as a workaround and it works fine. It's not clear why the shim System.Net.Dll that MvvmCross includes isn't redirecting the reference correctly to the native library.
I've got an error when I try to build a project (monodroid/mvvmcross).
This is the message error :
Error 37 The type 'Android.App.ListActivity' is defined in an assembly that is not referenced. You must add a reference to assembly 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=c4c4237547e4b6cd'.
Someone have an idea how to solve this problem ? This is strange because there wasn't this error before.
This error is located in MvxDialogActivityView.cs (cirrious.MvvmCross.Dialog.Droid)
I think your problem is that parts of your code is compiled against Xamarin.Android while others are compiled against Mono for Android.
See: http://forums.xamarin.com/discussion/1476/changes-to-assembly-strongnames-in-xamarin-android-4-6-0
You will need to recompile all parts of your application to target the same version of Xamarin's products.