当我在Android模拟器或我的Android设备上运行我的应用程序时,我在所有AJAX请求中遇到以下错误:
无法加载资源:服务器响应状态为404(找不到)已尝试所有以下步骤来解决此问题,但它仍然存在。
- 使用npm将白名单插件安装到项目中。 >
- 已将< plugin name =cordova-plugin-whitelistversion =1/> 添加到 config.xml
- 添加了< uses-permission android:name =android.permission.INTERNET/>
- 已添加< meta http-equiv =Content-Security-Policycontent =default-src * unsafe-inline';> 和< meta http-equiv =X-XSS-Protectioncontent =0> c /
- 添加< access origin = */> ,< allow-navigation href =*/> 和 < allow-intent href =*/> 到config.xml文件。
无论我仍然得到相同的错误。任何想法?
项目编译良好。我在Windows 7上使用Cordova 5.4.0,Android 5.1.1
解决方案删除应用程序的整个Android部分与:
cordova平台remove android并添加:
cordova平台添加android解决了这个问题,这对我来说还是个谜。
有一些问题,从早期版本的Cordova,使用当前Cordova版本没有得到很好。
When I run my application either in the Android emulator or on my Android device, I get he following error on all AJAX requests:
Failed to load resource: the server responded with a status of 404 (Not Found)I have tried all the following steps to solve this problem, but it persists.
- Installed the whitelist plugin to the 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"> to the <head> of www/index.html file.
- Added <access origin="*" />, <allow-navigation href="*" /> and <allow-intent href="*" /> to the config.xml file.
Regardless I still get the same errors. Any ideas?
The project compiles fine. I'm on Windows 7, using Cordova 5.4.0, Android 5.1.1
解决方案Removing the whole Android part of the application with:
cordova platform remove androidand adding it again with:
cordova platform add androidsolved the problem, which is still a mystery to me.
Perhaps there was something wrong left from the earlier versions of Cordova that wasn't getting on well with the current Cordova version.
更多推荐
Apache Cordova:无法加载资源:服务器响应状态为404(找不到)
发布评论