Visual Studio 2015
Xamarin 3.9.289
Xamarin.Android 4.20.0.34
I have a basic almost hello world type app that is making a rest call with basic authentication.
This is the most relevant error message I see in the debug output window:
02-09 21:50:38.362 D/Mono ( 2514): AOT module 'System.Net.Http.dll.so' not found: dlopen failed: library "/data/data/ATD.Droid/lib/System.Net.Http.dll.so" not found
The error occurs when I step over the line below await response.Content.ReadAsStringAsync();
Any ideas on what might be causing this problem. I have reference system.net and system.net.http in the project.
Thanks
Brady
public static async Task<T> GetAsync<T>(this HttpClient client, string url)
{
try {
var httpRequest = new HttpRequestMessage(new HttpMethod("GET"), url);
client.Timeout = TimeSpan.FromSeconds(30);
string username = "consportapi";
string password = "64ea2b32-d623-4e99-8683-7033ea4c70c5";
string t = string.Format("{0}:{1}", username, password);
byte[] bytes = Encoding.UTF8.GetBytes(string.Format("{0}:{1}", username, password));
string b64t = Convert.ToBase64String(bytes);
//client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(string.Format("basic {0}", b64t));
httpRequest.Headers.Add("Authorization", b64t);
var response = await client.SendAsync(httpRequest);
var jsonString = await response.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject<T>(jsonString);
return result;
} catch (Exception ex)
{
Debug.WriteLine(ex.Message);
return default(T);
}
}