Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
637 views
in Technique[技术] by (71.8m points)

android - 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...