Android Google maps java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion

Ramprasad picture Ramprasad · Jun 10, 2018 · Viewed 63.2k times · Source

I am using Google maps Android SDK 11.6.2(Also tried 15.0.1),but I get following crash before map shows. Already checked API key in manifest,it is available, but still this issue occurs. I am having targetSDk version as 28.Is it causes this issue.

java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion;
        at el.b(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100408-196123505):3)
        at ek.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100408-196123505):4)
        at em.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100408-196123505):51)
        at com.google.maps.api.android.lib6.drd.ap.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100408-196123505):11)
        at dw.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100408-196123505):16)
        at dw.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100408-196123505):61)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.ProtocolVersion" on path: DexPathList[[zip file "/system/priv-app/PrebuiltGmsCorePi/app_chimera/m/MapsDynamite.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/00000036/MapsDynamite.apk!/lib/armeabi-v7a, /data/user_de/0/com.google.android.gms/app_chimera/m/00000036/MapsDynamite.apk!/lib/armeabi, /system/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:126)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at ad.loadClass(:com.google.android.gms.dynamite_dynamiteloader@[email protected] (100408-196123505):25)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at el.b(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100408-196123505):3) 
        at ek.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100408-196123505):4) 
        at em.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100408-196123505):51) 
        at com.google.maps.api.android.lib6.drd.ap.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100408-196123505):11) 
        at dw.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100408-196123505):16) 
        at dw.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100408-196123505):61) 

Answer

ham picture ham · Jun 11, 2018

Put this in the Manifest <application> tag:

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

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