提取API无法加载file:///android_asset/www/xx/xxx.json. URL方案“文件";不支持 [英] Fetch API cannot load file:///android_asset/www/xx/xxx.json. URL scheme "file" is not supported
问题描述
使用 cordova 生成 Android应用,并添加 cordova热代码推送插件以自动更新应用,并使用 Fetch API 加载位于当前项目目录中的 JSON文件,问题是在更新应用程序时,无法重新加载任何JSON文件并抛出错误
Using cordova build Android app, and add cordova hot code push plugin to make app update automatically, and using Fetch API to load JSON files which located in current project directory, the problem is when update the app, any JSON files cannot be reload,and throw the error
Fetch API无法加载file:///android_asset/www/xx/xxx.json.网址 方案文件"不受支持.
Fetch API cannot load file:///android_asset/www/xx/xxx.json. URL scheme "file" is not supported.
如何解决Android应用程序中的Fecth错误?还是需要将任何插件添加到我的cordova项目中?
How to solve this Fecth error in Android app? Or is there any plugin that need add to my cordova project?
推荐答案
https ://github.com/github/fetch/pull/92#issuecomment-140665932
您可以使用XMLHttpRequest加载本地资产.
You may use XMLHttpRequest for loading local assets.
这篇关于提取API无法加载file:///android_asset/www/xx/xxx.json. URL方案“文件";不支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!