安卓No Network Security Config specified, using platform default

滴滴咚咚咚 2020-06-19 10:59:26
安卓请求网络资源会出现这个提示No Network Security Config specified, using platform default
百度加了
```
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
```
还是不行。加了这个android:usesCleartextTraffic="true" 也不行。
加network-security-config.xml文件也不行
刚学习安卓 实在不知道咋办了
这是我的配置
```
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.loginpage">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:usesCleartextTraffic="true"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<uses-library android:name="org.apache.http.legacy" android:required="false" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

</manifest>
```
...全文
4861 13 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
java脑袋 2022-03-08
  • 打赏
  • 举报
回复

我也卡这里了,解决了吗?

weixin_50771287 2020-12-25
  • 打赏
  • 举报
回复
我也卡这了
滴滴咚咚咚 2020-11-23
  • 打赏
  • 举报
回复
引用 9 楼 Cestbons 的回复:
你的问题解决了吗?我也出现这个问题了
我用okhtt3方式请求就可以了
咕噜叽哩哇啦 2020-11-22
  • 打赏
  • 举报
回复
你的问题解决了吗?我也出现这个问题了
初学者-Study 2020-06-29
  • 打赏
  • 举报
回复
可以,1317057860,我的项目中都是可以正常使用的
滴滴咚咚咚 2020-06-29
  • 打赏
  • 举报
回复
引用 3 楼 初学者-Study 的回复:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true" />
</network-security-config>
这是因为Android9.0之后默认使用https访问网络,所以你需要配置一个这样的文件,更重要的配置之后你要在AndroidManifest.xml的application标签中使用才行,否则等于没有配
我能加下你qq吗
滴滴咚咚咚 2020-06-29
  • 打赏
  • 举报
回复
引用 3 楼 初学者-Study 的回复:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true" />
</network-security-config>
这是因为Android9.0之后默认使用https访问网络,所以你需要配置一个这样的文件,更重要的配置之后你要在AndroidManifest.xml的application标签中使用才行,否则等于没有配
你好 我加了这个用api29不行 api28可以
滴滴咚咚咚 2020-06-29
  • 打赏
  • 举报
回复
引用 2 楼 王能 的回复:
这只是提示吧,不像报错,黄色的是提示
是的 是提示 我用之前用的api29 现在用api28是可以的
初学者-Study 2020-06-29
  • 打赏
  • 举报
回复

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true" />
</network-security-config>
这是因为Android9.0之后默认使用https访问网络,所以你需要配置一个这样的文件,更重要的配置之后你要在AndroidManifest.xml的application标签中使用才行,否则等于没有配
立青_ 中级 2020-06-29
  • 打赏
  • 举报
回复 1
android:usesCleartextTraffic="true"
王能 2020-06-24
  • 打赏
  • 举报
回复
这只是提示吧,不像报错,黄色的是提示
滴滴咚咚咚 2020-06-19
  • 打赏
  • 举报
回复 5
配置network-security-config.xml文件之后出现了新的错Using Network Security Config from resource network_security_config debugBuild: true
kiss0932 2022-03-01
  • 举报
回复
@滴滴咚咚咚 老哥 你这个怎么解决的?

80,472

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧