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.
Related
I have an old WPF/HelixToolkit/SharpDX project from 2016 that I started working with. I was having some viewport issues and thought they might be cured by updating HelixToolkit & SharpDX packages. Unfortunately, after the updates my project will no longer compile.
I tried Build->Clean and Rebuild All, but no joy. Still getting these errors:
Severity Code Description Project File Line Suppression State
Error The "SharpDX.Toolkit.EffectCompilerTask" task could not be loaded from the assembly \SharpDX.Toolkit.CompilerTask.dll. Could not load file or assembly 'file:///C:\SharpDX.Toolkit.CompilerTask.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. MyWPFMagViewer2
Severity Code Description Project File Line Suppression State
Warning The referenced component 'SharpDX.Toolkit.Compiler' could not be found. MyWPFMagViewer2
I'm really hoping it's something simple, but I don't have a clue what it might be. Can anyone help?
TIA,
Frank
I never found an answer to this problem, but I was able to work around it by re-cloning my project from GitHub, and not updating SharpDX
Frank
I'm trying to upgrade to the latest IOS-Unity plugin and I keep getting this compilation error:
Assets/Scripts/Analytics.cs(38,16): error CS0012: The type
System.Threading.Tasks.Task' is defined in an assembly that is not
referenced. Consider adding a reference to assemblyUnity.Tasks,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
It's worth noting that before this error it complained about a duplicate UnityCompat.dll file (defined in both Firebase/Plugins and Parse/Plugins -- I ended up removing the one in the Parse directory, but I have tried the opposite as well).
Any pointers would be great. Also worth noting that this happened after removing obsolete files from the PlayServices plugin when prompted.
Answering my own question (from https://groups.google.com/forum/#!topic/firebase-talk/2w1Lk62VIcg)
Parse/Plugins/Unity.Tasks needs to the enabled for compilation (using Unity's Inspector)
Parse/Plugins/Unity.Compat needs to be disabled
I had a similar problem and resolved it by following the documentation :
(https://firebase.google.com/docs/unity/setup#set_up_environment)
Assets > Play Services Resolver > Version Handler > Update to enable the correct DLLs for your project.
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.