The default API level in the Cordova Android platform has been upgraded. On an Android 9 device, clear text communication is now disabled by default.
To allow clear text communication again, set the android:usesCleartextTraffic
on your application
tag to true
:
<platform name="android">
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:usesCleartextTraffic="true" />
</edit-config>
</platform>
As noted in the comments, if you have not defined the android
XML namespace previously, you will receive an error: unbound prefix
during build. This indicates that you need to add it to your widget
tag in the same config.xml
, like so:
<widget id="you-app-id" version="1.2.3"
xmlns="http://www.w3.org/ns/widgets"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:cdv="http://cordova.apache.org/ns/1.0">
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…