我正在使用 Google 地图 Android SDK 11.6.2(也尝试过 15.0.1),但在地图显示之前我遇到了以下崩溃。已在清单中检查 API 密钥,它可用,但仍然出现此问题。我的 targetSDk 版本为 28。是否会导致此问题。
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion; at el.b(:com.google.android.gms.dynamite_mapsdynamite@12848063@12.8.48 (100408-196123505):3) at ek.a(:com.google.android.gms.dynamite_mapsdynamite@12848063@12.8.48 (100408-196123505):4) at em.a(:com.google.android.gms.dynamite_mapsdynamite@12848063@12.8.48 (100408-196123505):51) at com.google.maps.api.android.lib6.drd.ap.a(:com.google.android.gms.dynamite_mapsdynamite@12848063@12.8.48 (100408-196123505):11) at dw.a(:com.google.android.gms.dynamite_mapsdynamite@12848063@12.8.48 (100408-196123505):16) at dw.run(:com.google.android.gms.dynamite_mapsdynamite@12848063@12.8.48 (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@12848063@12.8.48 (100408-196123505):25) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at el.b(:com.google.android.gms.dynamite_mapsdynamite@12848063@12.8.48 (100408-196123505):3)聽 at ek.a(:com.google.android.gms.dynamite_mapsdynamite@12848063@12.8.48 (100408-196123505):4)聽 at em.a(:com.google.android.gms.dynamite_mapsdynamite@12848063@12.8.48 (100408-196123505):51)聽 at com.google.maps.api.android.lib6.drd.ap.a(:com.google.android.gms.dynamite_mapsdynamite@12848063@12.8.48 (100408-196123505):11)聽 at dw.a(:com.google.android.gms.dynamite_mapsdynamite@12848063@12.8.48 (100408-196123505):16)聽 at dw.run(:com.google.android.gms.dynamite_mapsdynamite@12848063@12.8.48 (100408-196123505):61)聽
把它放在清单<application>标签中:
<application>
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
更多信息: https ://issuetracker.google.com/issues/79478779