android - android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork error while android app makes http api
问题描述
I've developed an android app. The app works fine while app makes the HTTP API calls with https://. But app throws the error when app makes the same HTTP API calls with http://.
android.os.NetworkOnMainThreadException at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1145)
there are no issues with APIs. I've tested the APIs (both https and http) with the postman.
I'm using Volley library and OkHttp library for HTTP API calls.
kindly help me to resolve this. Thanks in advance.
解决方案
推荐阅读
- flutter - 在 chart_flutter 小部件中使用 NumericEndPointsTickProviderSpec 呈现在图表外部的条形图
- python - 带有 UDF 的 PySpark 数据框
- r - R 基于两个索引列对两列中的值求和,留下 NA 值
- c# - ASP.NET MVC 在创建新用户时向表中添加另一条记录
- python - 在 Django 中通过 URL 传递列表时出错
- c# - 我正在尝试创建一个命令,使机器人 DM 在指定时间成为用户
- java - 为什么将 Web 应用程序重写为多模块样式时出现“错误实例化 servlet 类 [servlet.LoginServlet]”
- authentication - 使用带有 SSL 加密但无身份验证的 Kafka(无服务器验证或客户端身份验证)
- ruby - 如何使用 apt 安装指定的 Ruby 版本
- java - 在类路径资源中定义名称为“jwtDecoderByJwkKeySetUri”的 bean 创建错误