A recent report on Embarcadero’s Quality Portal caught my attention today, where an app would crash if it used a TMapView on an Android 9 device. Fortunately, I had just recently updated my Nexus 5X to Android 9 (thanks to Brian Long’s help), so I could investigate the problem.

First thing to do was to create a new project, place a TMapView on the form, populate the apiKey value in the project options:

..and check the Maps Service checkbox in the Entitlements section:

Next, I fired up Monitor, which comes with the Android SDK tools (run monitor.bat, which is in the tools folder from the root of the Android SDK) and start the Android app. Lo and behold, when the app crashed, the logcat messages indicated an error:

A quick Google of the error (searching on “Failed resolution of: Lorg/apache/http/ProtocolVersion”) revealed a discussion on StackOverflow, and more importantly, what to do about it. The solution is incredibly simple: just add a tag to the AndroidManifest.template.xml:

the text is:

[sourcecode language=”xml”]
<uses-library android:name="org.apache.http.legacy" android:required="false" />

..and all is good in the world again!