0

an specific issue has occured in my project. I've found only one library for C# supporting Android (in Xamarin): Sharp.XMPP, NuGet, but I have troubles with it. When I write some sample code in separated portable class library, I get these errors:

Error 1: '.ctor' is not supported by the language

by the line

using (XmppClient client = new XmppClient(hostname, username, password))
            {
              ...
            }

Next:

Error 2: Metadata file '...\Project.Jabber.dll' could not be found  
Warnings 2-6: Reference to type 'System.Net.Security.RemoteCertificateValidationCallback' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile78\System.dll', but it could not be found   c:\Users\Kliford\Downloads\S22.Xmpp\S22.Xmpp.dll 

I am clueless. Thank you in advance.

Kliford
  • 3
  • 4

2 Answers2

0

This also happens when a lower library is using a different version of the .NET Framework. You try to update de library at the same version of the .NET Framework that you use and it should work.

Iván Oliver
  • 126
  • 3
0

Sharp.Xmpp is not compatible with PCL since it uses the XmlElement class, which is not currently available in PCL.

Rewriting this part is doable, but requires a significant effort.

The workaround that I use, is to develop .Net 4.5 Class libraries, which reference Sharp.XMPP. Portability among Windows and .Net is achieved through Xamarin.

Hope this helps

leo.fcx
  • 6,137
  • 2
  • 21
  • 37
Sharp.XMPP
  • 31
  • 3
  • Ok, I finally set up the project with the library, thanks a lot, but after I connect, the error occured: host-unknown. Any idea? – Kliford Sep 18 '15 at 13:56
  • Probably some DNS setup issue. Setting up the XMPP server needs some configuration. You can post a new question here or at github, I will be happy to help out if I can. – Sharp.XMPP Sep 23 '15 at 10:11
  • [Here](http://stackoverflow.com/questions/32780463/host-unknown-exception-in-xmpp-xamarin-android) is the question. Thanks a lot, I really appreciate an effort. – Kliford Sep 25 '15 at 10:49