因此,正如他的标题所说,volley抛出了“不允许明文http流量”的错误,尽管在android清单文件和网络配置安全文件中添加了所有必要的更改。我正在android studio中制作我的项目,希望能得到一些帮助。我已经尝试过清理项目,重建它,并使缓存失效。毫无办法。
清单文件:(无法显示包名)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dist="http://schemas.android.com/apk/distribution"
xmlns:tools="http://schemas.android.com/tools"
package="">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
android:networkSecurityConfig="@xml/network_security_config"
tools:replace="android:networkSecurityConfig">
<activity android:name=".SplashScreen"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".VerifyOtp" />
<activity android:name=".MainActivity">
</activity>
</application>
<dist:module dist:instant="true" />
</manifest>
发布于 2019-09-05 08:38:24
如果您Url是"https://example.com“,则只需添加example.com和您希望允许访问的其他url,如下所示
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">example.com</domain>
<domain includeSubdomains="true">example1.com</domain>
</domain-config>
<base-config cleartextTrafficPermitted="false" />
</network-security-config>
https://stackoverflow.com/questions/57800975
复制相似问题