Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App crashes when running maps activity

My projects Map activity is not working
I just pasted the api key in place google_maps_api.xml and clicked run

Logcat:

E/AndroidRuntime: FATAL EXCEPTION: Thread-5 Process: com.example.appmy.lofind, PID: 10901 java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion; at el.b(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (040700-196123505):3) at ek.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (040700-196123505):4) at em.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (040700-196123505):51) at com.google.maps.api.android.lib6.drd.ap.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (040700-196123505):11) at dw.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (040700-196123505):16) at dw.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (040700-196123505):61) Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.ProtocolVersion" on path: DexPathList[[zip file "/system/priv-app/PrebuiltGmsCore/app_chimera/m/MapsDynamite.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/00000006/MapsDynamite.apk!/lib/x86, /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] (040700-196123505):25) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at el.b(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (040700-196123505):3)  at ek.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (040700-196123505):4)  at em.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (040700-196123505):51)  at com.google.maps.api.android.lib6.drd.ap.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (040700-196123505):11)  at dw.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (040700-196123505):16)  at dw.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (040700-196123505):61)  E/SchedPolicy: set_timerslack_ns write failed: Operation not permitted

like image 454
MajdNaji Avatar asked Jun 17 '18 13:06

MajdNaji


People also ask

Why Does My Maps app keep closing?

Clear the app's cache & data On your Android phone or tablet, open the Settings app . Tap Apps & notifications. Follow the steps on your device to find the Maps app. After you select the app, storage & cache options should be available.

What does it mean when an app keeps crashing?

This usually occurs when your Wi-Fi or cellular data is slow or unstable, causing apps to malfunction. Another reason for Android apps crashing can be a lack of storage space in your device. This can occur when you overload your device's internal memory with heavy apps.


1 Answers

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"/>

like image 102
Eduard Bosch Bertran Avatar answered Sep 21 '22 08:09

Eduard Bosch Bertran