我正在使用 Capacitor 开发 Ionic 4 应用,尝试从本地主机调用 API,但是出现了以下错误:
请求存在问题:不允许与 localhost 进行明文 HTTP 通信
!请求存在问题:不允许与 localhost 进行明文 HTTP 通信
!<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:usesCleartextTraffic="true"
如果您需要更精细调整的面向特定领域的方法,我建议阅读这篇文章:https://developer.android.com/training/articles/security-config#CleartextTrafficPermitted