Does Windows assembly not exist in the mono for Android profile? - xamarin.ios

I am developing a sample Xamarin application and i got a build error for Android profile,following is the error.
Exception while loading assemblies: System.IO.FileNotFoundException:
Could not load assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken='.
Perhaps it doesn't exist in the Mono for Android profile? File name: 'Windows.dll' at
Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
Xamarin.Android.Tasks.ResolveAssemblies.Execute()
I couldn't understand what is the exact problem,is windows assembly is not exist in the mono for Android profile? Please help me.

You can see all the available assemblies here:
Xamarin.Android: http://docs.xamarin.com/guides/android/advanced_topics/assemblies
Xamarin.iOS: http://docs.xamarin.com/guides/ios/advanced_topics/assemblies
So no Windows.dll is not available. You can also scan your current assemblies for compatibility here: http://scan.xamarin.com/

there should be updates available in your android sdk.

Related

Xamarin.Forms Failed to resolve assembly stateless error

After upgrading to the latest version of Xamarin.Forms (2.3.3.175) my iOS project throws the compilation error
Failed to resolve assembly: 'Stateless, Version=2.5.53.0, Culture=neutral, ...' (MT2002) in File MTOUCH and Path MTOUCH
The shared code is in a PCL library targeting PCL 4.5 - Profile78
So far Google search hasn't returned anything.
Anyone encounter this yet? Appreciate any help in resolving this.
I am using Xamarin Studio Community Edition version 6.1.2 (Build 44)
You are likely using couchbase lite. Stateless is an assembly required by couchbase lite. It seems it cannot be resolved if used in a pcl project. You can read something about this problem here. A couchbase developer states that
The strategy has changed since then. We won't be supporting PCL but instead we aim to support .NET Standard 2.0 when it is ready.
Hope this helps.
Xamarin.Forms has NO dependency on an assembly named Stateless of any sort. Check your dependencies, and your dependencies dependencies...

How to use ServiceStack.OrmLite with a Xamarin Android project

Is it possible to use ServiceStack OrmLite on a Xamarin android project? I'm having a hard time finding the right combination of dlls. I've tried building from ServiceStack.OrmLite.Android.sln and using the resulting dlls, but when I add ServiceStack.OrmLite.Sqlite.Android.dll to the solution I get the following error when I build:
Error 2 Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'System.Data.Linq.dll'
at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
at Xamarin.Android.Tasks.ResolveAssemblies.Execute() C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 853 2 AndroidApplication1
I have seen some post around indicating they were able to use Ormlite with a Xamarin android project, but they don't have any details on the implementation and they are old enough that they probably used v3 of ServiceStack.
I'm using the starter edition of ServiceStack, although i don't think that would have any impact.
Thanks,
Estyn
Either build the V3 branch source code or get the DLL's from here:
https://github.com/sami1971/SimplyMobile/tree/master/libs/ServiceStack
You can also fork this branch of ServiceStack.OrmLite if nothing else works, it's where I first published OrmLite Android & iOS support: https://github.com/sami1971/ServiceStack.OrmLite-1

Unable to load Json.NET dll Xamarin Studio

I have an Indie license for Xamarin so that I can develop apps for iPhone/iPad in my most proficient programming language, C#. With this license I can't use the Visual Studio plugin from Xamarin. I still prefer Visual Studio to Xamarin Studio, so I still develop on Visual Studio whatever code that does not need MonoTouch references and then just manually copy the dll into Xamarin Studio.
I have one assembly, .Net framework 4.5, that gets the following error message when I try to debug my app:
Loaded assembly: /Users/EdGriMac/Dropbox/Quiz/Newtonsoft.Json.dll
[External]
2013-09-23 20:30:38.021 Exam936[2228:c07] Could not load 'Newtonsoft.Json' for registration:
System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes
(System.Reflection.Assembly,bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in
/Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/Assembly.cs:351
at MonoTouch.Registrar.OldDynamicRegistrar.RegisterAssembly
(System.Reflection.Assembly a) [0x00000] in
/Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/OldDynamicRegistrar.cs:67
2013-09-23 20:30:38.023 Exam936[2228:c07] This could be due to an outdated assembly kept by the simulator, location:
/Users/EdGriMac/Dropbox/Quiz/Newtonsoft.Json.dll
My tries:
The first thing that springs to mind is that NewtonSoft.Json can't be used with MonoTouch, but I don't know how to find out. Is there a way to find out for sure if a 3rd party dll can be used?
My second idea was that an older or newer version of NewtonSoft.Json could be used by another assembly. This is not a large project, however, and the only other assembly I have that uses Json is RestSharp, but I don't think that uses NewtonSoft.Json. I looked at the web pages for their GitHub page, but was unable to find a reference.
I googled a bit and found this post saying that (a bit down) MonoTouch.Registrar.OldDynamicRegistrar.RegisterAssembly indicates that (quote:) I can't build the app using the build flags --registrar:olddynamic. If I remove that, it now works, I can now link and it appears to be working.. This is probably a setting in Visual Studio you can adjust when you have a Business license. I don't know how to build without these flags.
Is what I am trying to do possible? If yes, what should I do?
Thanks in advance!
The Json.NET version from Xamarin component store (http://components.xamarin.com/view/json.net/) works fine. And it installs directly from within Xamarin Studio

Simple DataAccess PCL Library for Monotouch/Android/WindowsPhone

I'm trying to create simple DataAccess portable class library for 3 platforms (ios, android, wp7.5).
All I want is to create webrequests, convert data and return it to UI of each platform.
I was able to create library like this (portable) under Mac OS X Xamarin Studio and successfully used it at iPhone app.
But then I opened this solution under Visual Studio (to add Windows Phone UI project) it gave me build error with description that it couldn't find System.Net namespace.
When I checked portable class targets I was surprised to see there even XBOX selected:
When I selected correct targets (MonoDroid/Monotouch/WindowsPhone7.5) I was able to compile but when I start the app I received the following error:
"c:\Downloads\Noname.CrossXam\Noname.CrossXam\Noname.CrossXam.iPhone\Noname.CrossXam.iPhone.csproj"
(_RemoteBuild target) (1) -> (_ResolveAssemblies target) ->
C:\Program Files
(x86)\MSBuild\Xamarin\iOS\Xamarin.MonoTouch.Common.targets(68,3):
error : Exception while loading assemblies:
System.IO.FileNotFoundException: Could not load assembly 'System.Net,
Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
Perhaps it doesn't exist in the MonoTouch profile? ...
0 Warning(s)
1 Error(s)
Same code (same solution) works just fine under Mac OS X with Xamarin Studio.
Sample solution is here:
https://dl.dropboxusercontent.com/u/19503836/Noname.CrossXam.zip
Please advise.
The issue was in System.Net.dll assembly which is not exists under MonoTouch & MonoAndroid profiles. But that classes are implemented at System.dll under those profile and to make it work you need TypeForwardedToAttribute.
All that type forwarding configuration exists at MVVMCross nuget package which I was able to install only after updating nuget (the last comment from this post: http://slodge.blogspot.com/2013/04/my-current-pcl-setup-in-visual-studio.html)
So there were two issues:
1. Old nuget package manager (update is required)
2. TypeForwardedToAttribute configuration (exists at MvvmCross)
Hope it will be useful for someone.
Have you tried to change target framework to .Net 4.5? You should see Profile104 in your .csproj file

Referenceproblem using SmartThreadPool in Mono for Android

I want to use SmartThreadPool in a Mono for Android Application. Unfortunatley I am getting an error, when I reference the SmartThreadPool.dll from the project:
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(2,2):
Error: Exception while loading assemblies: System.IO.FileNotFoundException:
Could not load assembly 'System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for
Android profile?
File name: 'System.Web.dll'
at Monodroid.Tuner.MonoDroidResolver.Resolve(AssemblyNameReference reference,
ReaderParameters parameters)
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1
assemblies, AssemblyDefinition assembly)
at Xamarin.Android.Tasks.ResolveAssemblies.Execute()
I already tried to put the library under the Assets folder and set its BuildAction to AndroidAssets as read in http://adnankhan12.wordpress.com/2012/10/23/android-mono-error-using-other-dlls-novell-monodroid-common-targets. But still it does not work.
At the moment, I am not able to use SmartThreadPool, but on the webpage of the project mono support is stated explicitly. So what am I missing or doing wrong?
Can somebody help me?
Thanks in advance.
According to the API Reference documentation the only class accessible from the namespace System.Web is HttpUtility class.
You might be right that Mono does have SmartThreadPool, however it is not included in Mono for Android and MonoTouch.
You can see which assemblies ship with Mono for Android here, and for MonoTouch here.
EDIT:
Also the DLL you are referencing is not built with either the Mono for Android or Monotouch compile and hence you will have troubles referencing it in your project. You also need to be aware of dependencies it might have.

Resources