I recently updated an older app, and changed the target API from 27 to 28, as recommended. This app is using an older (15.x.x) version of the Google Maps library. Upon trying to actually use Google Maps, I received the following crash:
Fatal Exception: java.lang.NoClassDefFoundError Failed resolution of: Lorg/apache/http/ProtocolVersion;
With a detailed message of:
Caused by java.lang.ClassNotFoundException Didn't find class "org.apache.http.ProtocolVersion" on path: DexPathList[[zip file "/data/user_de/0/com.google.android.gms/app_chimera/m/0000003d/MapsDynamite.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/0000003d/MapsDynamite.apk!/lib/armeabi-v7a, /data/user_de/0/com.google.android.gms/app_chimera/m/0000003d/MapsDynamite.apk!/lib/armeabi, /system/lib]]
Newer Android versions no longer include the library (Apache HTTP) Google Maps and other libraries require, leading to this problem.
The recommended solution is to either update the Google Maps dependency in the Gradle file to at least 16.1.x (or update whichever library has the issue), but there is another workaround too. Just adding a declaration that you still need the library into your manifest within the
<application> tag will resolve it:
<uses-library android:name="org.apache.http.legacy" android:required="false"