首页 > 解决方案 > 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.

标签: androidapiresthttpandroid-network-security-config

解决方案


推荐阅读