2

I've created a fresh Xmarain.Forms project and a fresh Xmarain.Forms UI Tests project. I've managed to get the freshly created Android apk built and installed to my emulated device.

My Unit Tests application is able to connect to the installed apk. When it attempts to run the first test I get the following error though:

System.Net.WebException : POST Failed
   at Xamarin.UITest.Shared.Http.HttpClient.HandleHttpError(String method, HttpResponseMessage response, ExceptionPolicy exceptionPolicy)
   at Xamarin.UITest.Shared.Http.HttpClient.SendData(String endpoint, String method, HttpContent content, ExceptionPolicy exceptionPolicy, Nullable`1 timeOut)
   at Xamarin.UITest.Shared.Http.HttpClient.Post(String endpoint, String arguments, ExceptionPolicy exceptionPolicy, Nullable`1 timeOut)
   at Xamarin.UITest.Shared.Android.HttpApplicationStarter.Execute(String intentJson)
   at Xamarin.UITest.Shared.Android.LocalAndroidAppLifeCycle.LaunchApp(String appPackageName, ApkFile testServerApkFile, Int32 testServerPort)
   at Xamarin.UITest.Android.AndroidApp..ctor(IAndroidAppConfiguration appConfiguration, IExecutor executor)
   at Xamarin.UITest.Configuration.AndroidAppConfigurator.StartApp(AppDataMode appDataMode)
   at New.Mobile.Tests.AppTests.BeforeEachTest()

My AndroidManifest.xml is pretty basic:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.New.Mobile" android:installLocation="internalOnly">
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="28" />
<application android:label="New.Mobile.Android" 
<uses-permission android:name="android.permission.INTERNET" />
</manifest>

I don't even have any http calls in my app. What gives? How do you even begin to debug something like this?

3
  • I am facing the same issue and I created the project in Visual studio as Xamarin UI test project. Any working solution?
    – Ubaid Rana
    Jul 15, 2020 at 14:20
  • @UbaidRana did you try the answer I have aded? Jul 15, 2020 at 20:58
  • 1
    Yes, but I already created the project in Visual Studio, so it doesn't apply in my case
    – Ubaid Rana
    Jul 16, 2020 at 7:30

1 Answer 1

1

The issue was that the Test Project was created in Rider. Creating the Test project in visual studio allows you to progress beyond this error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.