Issue with Maps SDK for Android

1.5k Views Asked by At

I am fairly new to android app development. Today i tried to implement a map inn my app, and cannot make it work. I even tried to make a new app with the default map activity, which crashes instantly.

This is the error I am getting:

   --------- beginning of crash
2018-12-25 23:03:24.440 8401-8428/? E/AndroidRuntime: FATAL EXCEPTION: Thread-5
Process: com.example.krist.maptest, PID: 8401
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion;
    at ez.b(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100400-223214910):3)
    at ey.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100400-223214910):3)
    at fa.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100400-223214910):15)
    at com.google.maps.api.android.lib6.drd.al.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100400-223214910):6)
    at ed.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100400-223214910):21)
    at ed.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100400-223214910):8)
 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/00000016/MapsDynamite.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/00000016/MapsDynamite.apk!/lib/arm64-v8a, /system/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at ad.loadClass(:com.google.android.gms.dynamite_dynamiteloader@[email protected] (100400-223214910):4)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    at ez.b(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100400-223214910):3) 
    at ey.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100400-223214910):3) 
    at fa.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100400-223214910):15) 
    at com.google.maps.api.android.lib6.drd.al.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100400-223214910):6) 
    at ed.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100400-223214910):21) 
    at ed.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] 
(100400-223214910):8) 

I am running on a Pixel 3XL with the latest updates. Any ideas what the issue might be? Thanks.

2

There are 2 best solutions below

0
On

Check if dependencies are set up correctly. Play services and gmaps versions should not vary. Enable multidexing in your build. add this line in dependencies: implementation 'com.android.support:multidex:1.0.3' and make these changes in defaultConfig: android { defaultConfig { ...

    multiDexEnabled true
}
...

} And sync project.

0
On

I also had same issue, and it was solved pasting this line of code to 'application' element of AndroidManifest.xml.

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

Hope it helped you.