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

标签 android apache cordova xss

当我在 Android 模拟器或我的 Android 设备上运行我的应用程序时,我在所有 AJAX 请求中遇到以下错误:

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

我已经尝试了以下所有步骤来解决这个问题,但它仍然存在。

  • 使用 npm 将白名单插件安装到项目中。
  • 已添加 <plugin name="cordova-plugin-whitelist" version="1" />至 配置.xml。
  • 已添加 <uses-permission android:name="android.permission.INTERNET" /> 到 platforms\android\AndroidManifest.xml。
  • 已添加 <meta http-equiv="Content-Security-Policy" content="default-src * 'unsafe-inline';"><meta http-equiv="X-XSS-Protection" content="0"><head>的 www/index.html 文件。
  • 已添加 <access origin="*" /> , <allow-navigation href="*" /><allow-intent href="*" />到 config.xml 文件。

无论如何,我仍然会遇到同样的错误。有什么想法吗?

项目编译正常。我在 Windows 7 上,使用 Cordova 5.4.0,Android 5.1.1

最佳答案

删除应用程序的整个 Android 部分:

cordova platform remove android

并再次添加:

cordova platform add android

解决了这个问题,这对我来说仍然是个谜。

也许早期版本的 Cordova 遗留了一些错误,这些错误与当前的 Cordova 版本不兼容。

关于android - Apache Cordova : Failed to load resource: the server responded with a status of 404 (Not Found),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33861413/

相关文章:

android - 关闭 Android 应用程序

python - htaccess 导致 python cgi 出现问题

apache - htaccess 将主机名重定向到 FQDN

android - 在 mac 错误 2 上展开 ADT

node.js - 如何使用不同版本的 Npm 和 Cordova

android - 如何在Service和Activity之间传递复杂的数据?

android - 图标集可见复制菜单

mysql - Apache MySQL - "#08S01Got packets out of order"

javascript - 将 javascript 数组传递到另一个页面

java - 如何删除 java.lang.IndexOutOfBoundsException?