App crashes when running maps activity

Put this in the Manifest tag:

<uses-library android:name="org.apache.http.legacy" android:required="false"/>

More info: https://issuetracker.google.com/issues/79478779

as google documentation said:

If you are using com.google.android.gms:play-services-maps:16.0.0 or below and your app is targeting API level 28 (Android 9.0) or above, you must include the following declaration within the element of AndroidManifest.xml.


I've found another solution at Android Google maps java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion

Just add this in your manifest:

<uses-library android:name="org.apache.http.legacy" android:required="false"/>

Update:

Starting from Google Maps SDK version 16.1.0 you can skip adding the solution above as the tag has been added to the AndroidManifest of the maps library.

https://developers.google.com/maps/documentation/android-sdk/releases#2019-02-06

Added the following declaration to the AndroidManifest.xml to support the Apache HTTP client on Android P and above. After updating to com.google.android.gms:play-services-maps:16.1.0 you can remove this line from your own AndroidManifest.xml. (Issue 117591497)

<uses-library android:name="org.apache.http.legacy" android:required="false"/>


The same problem here when using target SDK 28. Reverting to SDK 27 solved the problem.


Don't revert your target SDK.

Better use this solution https://stackoverflow.com/a/50944537/5710605