gpt4 book ai didi

java - 一些 api 调用在 Android 9 上失败

转载 作者:行者123 更新时间:2023-12-04 10:06:52 24 4
gpt4 key购买 nike

我有一个应用程序可以在低于 Android 9 的设备上完美运行。我刚刚实现了 android:usesCleartextTraffic="true"在我的 list 上支持 Android 9 及更高版本。问题是,在我的三星 note 8 上,该应用程序运行良好,但在 friend 的三星 note 8 上;即使网络连接良好,某些 api 调用也总是失败。可能是什么问题?

最佳答案

我已经通过创建 network_security_config.xml 解决了我的问题在 res -> xml 文件夹中

<network-security-config>
<base-config cleartextTrafficPermitted="true" />
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true"> /* your base url Eg: http://mide.awsnode.com/ */</domain>
<domain includeSubdomains="true"> /*--- another url (if have) */ </domain>
</domain-config>
</network-security-config>

在 list 中
<application
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:logo="@drawable/new_logo_ag"
android:networkSecurityConfig="@xml/network_security_config" // define the xml
android:roundIcon="@drawable/new_logo_ag"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:targetApi="n">

也许这可以帮助你

关于java - 一些 api 调用在 Android 9 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61542110/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com