我正在尝试做的故事的较短版本:通过 cordova app loader. 在 cordova 运行时加载 Web 应用程序 webapp 是基于 ExtJS 构建的
过程
- 正在构建 ExtJS 应用程序。
- bootstrap.js 是为微型加载器概念生成的。
- manifest.json 生成
- Cordova 应用程序能够下载和加载外部网络应用程序。
在 android 和 iOS 上尝试时,iOS 版本运行良好,但 android 版本会抛出几个错误。
(index):1 Uncaught ReferenceError: start is not defined
at (index):1
(index):2 Uncaught ReferenceError: onHasParentDirectory is not defined
at (index):2
(index):3 Uncaught ReferenceError: addRow is not defined
at (index):3
(index):4 Uncaught ReferenceError: addRow is not defined
at (index):4
(index):5 Uncaught ReferenceError: addRow is not defined
at (index):5
(index):6 Uncaught ReferenceError: addRow is not defined
at (index):6
(index):7 Uncaught ReferenceError: addRow is not defined
at (index):7
(index):8 Uncaught ReferenceError: addRow is not defined
at (index):8
在进一步检查中,这似乎与 webview 在 android 中的工作方式以及它在哈希方面的问题有关。
来自链接的一些响应: - 问题是由于链接 (href) 带有前缀“/#/xxxx”而不是“#/xxxx”…… -file:///android_asset/www/main.html#"+ strippedUrl; 其中 strippedUrl 表示原始 url,file:///转换为 just/并可能将/android_asset/www 转换为空字符串,似乎是 4.0 Webview 中与 html5 路由和以/开头的路径相关的问题。
引用链接:
https://gist.github.com/morganrallen/f955cc0312ae2cdbe9a5 https://forum.ionicframework.com/t/uncaught-referenceerror-addrow-is-not-defined/9266/3
为了尝试这种方法,我尝试实现 hashbang 方法,但应用程序在 android 中仍然失败。
谁能告诉我如何解决这些错误或可能的解决方案。
P.S:如果我在没有 ExtJS 路由的情况下工作,应用程序可以完美运行。错误不在 ExtJS 项目中。
感谢和问候
最佳答案
我通过指定带有 index.html 的路径解决了这个问题。
之前是
downloadedAppUrl = fileSystem.root.nativeURL + 'app';
现在我指定
downloadedAppUrl = fileSystem.root.nativeURL + 'app/index.html';
关于android - 无法通过 cordova app loader : addRow is not defined 在 cordova android 上加载 ExtJS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54088500/