Ashley Jackson
Ashley Jackson

Reputation: 313

'HttpClientHandler.set_AutomaticDecompression' not found Error using Azure Mobile Services in Xamarin forms from Azure Project

I am creating a new App, using Xamarin forms. The App uses Azure Mobile Services v2.0.1.

The app runs fine on IOS but when running on Android I get the following error.

 'HttpClientHandler.set_AutomaticDecompression' not found 

Googling this, the answer seems to be to make sure Microsoft HTTP Client Libraries are installed for the PCL project and the Android App.

I have installed this in my Droid App but am still getting the error. Any further ideas?

My Package.config - with the http client in is:

  <package id="Microsoft.Azure.Mobile.Client" version="2.0.1" targetFramework="monoandroid60" />
  <package id="Microsoft.Azure.Mobile.Client.SQLiteStore" version="2.0.1" targetFramework="monoandroid60" />
  <package id="Microsoft.Bcl" version="1.1.10" targetFramework="monoandroid60" />
  <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="monoandroid60" />
  <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="monoandroid60" />
  <package id="modernhttpclient" version="2.4.2" targetFramework="monoandroid60" />
  <package id="Newtonsoft.Json" version="6.0.4" targetFramework="monoandroid60" />
  <package id="SQLitePCL" version="3.8.7.2" targetFramework="monoandroid60" />

Upvotes: 1

Views: 409

Answers (1)

Adrian Hall
Adrian Hall

Reputation: 8035

You are using ModernHttpClient, which requires additional setup (most notably adding a NativeMessageHandler() to the client invocation.

Needless to say, Azure Mobile Apps does not do this for you natively.

Try using

var client = new MobileServiceClient(yourUrl, new NativeMessageHandler());

... instead of the normal call. Alternatively, try without ModernHttpClient.

Upvotes: 1

Related Questions