使用cordova构建Android app,添加cordova hot code push插件实现应用自动更新,并使用Fetch API 加载位于当前项目目录下的JSON文件,问题是更新应用程序时,无法重新加载任何JSON文件,并抛出错误
Fetch API cannot load file:///android_asset/www/xx/xxx.json. URL scheme "file" is not supported.
如何解决 Android 应用中的 Fecth 错误?或者是否有任何插件需要添加到我的 cordova 项目中?
最佳答案
https://github.com/github/fetch/pull/92#issuecomment-140665932
您可以使用 XMLHttpRequest 加载本地资源。
关于android - 获取 API 无法加载文件 :///android_asset/www/xx/xxx. json。不支持 URL 方案 "file",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44278371/