地图版本 V1 在 Android 10 中崩溃 [英] Maps version V1 is crashing in Android 10

查看:23
本文介绍了地图版本 V1 在 Android 10 中崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 android 应用程序中使用地图版本 V1.它在 Android Pie(9) 之前运行良好,但在 Android 10 中崩溃了.我低于例外

I am using map version V1 in my android app. It's working fine till Android Pie(9) but it's crashing in Android 10. I am getting below exception

UncaughtException: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/client/HttpClient;
    at com.google.android.maps.MapActivity.<init>(MapActivity.java:356)

我已经在android清单文件中尝试过以下代码

I have already tried below code in android manifest file

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

以及我的 gradle 文件中的以下代码

and below code in my gradle file

useLibrary 'org.apache.http.legacy'

推荐答案

确保您已在 元素中添加了 Apache HTTP Legacy 声明,即:

Make sure you've added the Apache HTTP Legacy declaration within the <application> element, i.e.:

<application ...>

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

<application/>

如果您使用的是 com.google.android.gms:play-services-maps:16.1.0 或更高版本,那么您根本不需要添加它.请参阅 Google 的文档.

If you're using com.google.android.gms:play-services-maps:16.1.0 or above then you don't need to add this at all. Refer to Google's documentation.

我刚刚创建了一个面向 Android 10(API 级别 29)的地图活动项目,它对我来说运行没有问题.希望这对您有所帮助.

I just created a map activity project targeting Android 10 (API level 29) and it ran without problem for me. Hope this helps you.

这篇关于地图版本 V1 在 Android 10 中崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆