AnsweredAssumed Answered

Android 9 app crashes when execute await function

Question asked by massimom61 on Jul 5, 2019
Latest reply on Jul 9, 2019 by massimom61

Hi all,
I'am working on Visual Studio 2017 Community 15.9.13 with Xamarin 4.12.3.83 and Xamarin Android SDK 9.1.7.0.
I use ArcGIS runtime SDK for .NEt 100.5.0.

I want to compile and run the "Feature layer selection" or other similar code in the Sample Code section of the ArcGIS for Developer site.

When the target Android version is less then 9.0 (Pie) version, all functions well.
With Android 9.0 version the app is compiled and deployed correctly on my device while it crashes when it tries to execute an await function.

For axample:

...
Uri featureServiceUri = new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/DamageAssessment/FeatureServer/0");
var featureTable = new ServiceFeatureTable(featureServiceUri);
featureLayer = new FeatureLayer(featureTable);
await _featureLayer.LoadAsync(); // at this point the app crashes

...


When I catch the error, these are the Exception properties results:

***
HResult: -2146233088

 

InnerException: Java.IO.IOException: Cleartext HTTP traffic to sampleserver6.arcgisonline.com not permitted

 

Message: One or more errors occurred.

 

Source: mscorlib

 

StackTrace: at Esri.ArcGISRuntime.Http.ArcGISHttpClientHandler+ArcGISClientHandlerInternal+<>c__DisplayClass14_1.<SendAsync>b__0 (System.Threading.Tasks.Task`1[TResult] t) [0x00033] in C:\daily_r\api_xam\dotnet\api\src\Esri.ArcGISRuntime\Esri.ArcGISRuntime.Shared\Http\ArcGISHttpClientHandler.cs:703
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2[TAntecedentResult,TResult].InnerInvoke () [0x00024] in <d4a23bbd2f544c30a48c44dd622ce09f>:0
at System.Threading.Tasks.Task.Execute () [0x00000] in <d4a23bbd2f544c30a48c44dd622ce09f>:0
--- End of stack trace from previous location where exception was thrown ---
at Esri.ArcGISRuntime.Http.ArcGISHttpClientHandler+ArcGISClientHandlerInternal+<SendAsync>d__14.MoveNext () [0x008b5] in C:\daily_r\api_xam\dotnet\api\src\Esri.ArcGISRuntime\Esri.ArcGISRuntime.Shared\Http\ArcGISHttpClientHandler.cs:879
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Http.HttpClient+<SendAsyncWorker>d__49.MoveNext () [0x000
ca] in <25ebe1083eaf4329b5adfdd5bbb7aa57>:0
--- End of stack trace from previous location where exception was thrown ---
at Esri.ArcGISRuntime.Internal.RequestRequiredHandler+<IssueRequestAndRespond>d__14.MoveNext () [0x004f9] in C:\daily_r\api_xam\dotnet\api\src\Esri.ArcGISRuntime\Esri.ArcGISRuntime.Shared\Internal\RequestRequiredHandler.cs:245
--- End of stack trace from previous location where exception was thrown ---
at FeatureLayerSelectionTest.MainActivity+<Initialize>d__4.MoveNext () [0x00115] in C:\VisualStudio\Xamarin\Progetti\FeatureLayerSelectionTest\FeatureLayerSelectionTest\MainActivity.cs:82

 

TargetSite: Void Throw()
***

Can someone help me?

Many thanks

Regards


Massimo

Outcomes