Apache Cordova: Failed to load the resource: the server responded with a status of 404 (not found)

When I run my application either in the Android emulator or on my Android device, I get an error after all AJAX requests:

Failed to load resource: the server responded with a status of 404 (Not Found)

I tried to follow all the following steps to solve this problem, but it persists.

  • Installed a whitelist plugin in a project using npm.
  • Added <plugin name="cordova-plugin-whitelist" version="1" />to config.xml.
  • Added <uses-permission android:name="android.permission.INTERNET" /> to platforms \ android \ AndroidManifest.xml.
  • Added <meta http-equiv="Content-Security-Policy" content="default-src * 'unsafe-inline';">and <meta http-equiv="X-XSS-Protection" content="0">a file <head>file www / index.html.
  • Added <access origin="*" />, <allow-navigation href="*" />and <allow-intent href="*" />to the config.xml file.

Despite this, I still get the same errors. Any ideas?

The project compiles fine. I am on Windows 7 using Cordova 5.4.0, Android 5.1.1

+4
4

Android :

cordova platform remove android

cordova platform add android

, .

, - , .

+10

Android

cordova platform update android@5.1.1

php- , android

+2

, - * -src, Ajax- . connect-src Ajax- , . :

<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; connect-src http://myhost.mydomain.com">

Ajax- http://myhost.mydomain.com

, , , .

+1

Android . . , , - .

-3

Source: https://habr.com/ru/post/1616980/


All Articles