How to access 'http' on android 30?

55 Views Asked by At

I'm trying to access 'http://' on Android api 30, but I can only access https using 'com.android.volley:1.2.1' and 'com.squareup.retrofit2:retrofit:2.9.0'. I can access http when using 'com.squareup.okhttp3:okhttp:4.11.0'. What's the reason?

Other settings are as follows.

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:networkSecurityConfig="@xml/network_security_config"
          ....

<?xml version="1.0" encoding="utf-8"?>
<network-security-config xmlns:android="http://schemas.android.com/apk/res/android">
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">xxx.xxx.xxx.xxx:8080</domain>
    </domain-config>
</network-security-config>
  1. There is no http connection from Android api 30 to retrofit2, volley, and https access is possible.
  2. I can access http from Android api 27 to retrofit2, volley.
  3. With okhttp3 on Android api 30, http access is possible.
0

There are 0 best solutions below