Project scenario:
Package the vue project originally developed on the mobile phone as an apk and release it on Android.
Problem Description:
Everything works fine when debugging in the browser. However, when it is packaged as an apk and installed on a mobile phone, some Android phone requests cannot be sent normally, the server does not receive the request, and the request status code returns 0.
Cause Analysis:
1. There are two reasons currently known to me for the request status code to be 0:
a. I canceled the request in the code
b .Request blocked
2. After checking the Android update documentation, I found that for security reasons after Android 9.0, only https is used for sending by default, unless set by the developer.
solution:
If it is packaged through CordovaYou can find AndroidManifest.xml at this location in the project path
…/platforms/android/app/src/main/AndroidManifest.xml
File
Add in this file
android:usesCleartextTraffic="true
Package and publish again and install it on the mobile phone to send the request normally.