简体   繁体   English

Ionic app适用于ios但不适用于android

[英]Ionic app works with ios but does not on android

My app works fine with "ionic serve", ionic view and "ionic build ios" on ios device. 我的应用程序在ios设备上使用“离子服务”,离子视图和“离子构建ios”工作正常。 My app also works fine with ionic view on android. 我的应用程序也适用于android上的离子视图。 However, when I run "ionic run android" and install the app on android device, it only shows white blank page and does not work. 但是,当我运行“离子运行android”并在Android设备上安装应用程序时,它只显示白色空白页,但不起作用。

People seem having similar issues and some possible solutions are discussed here: https://forum.ionicframework.com/t/ionic2-app-show-blank-screen-on-android-device-4-2-2-using-run-command-and-ionicview/39405/17 . 人们似乎有类似的问题,这里讨论一些可能的解决方案: https//forum.ionicframework.com/t/ionic2-app-show-blank-screen-on-android-device-4-2-2-using-run -command-and-ionicview / 39405/17 However, none of the solutions worked for me. 但是,没有一个解决方案适合我。 For example, I added crosswalk plugin but did not work. 例如,我添加了crosswalk插件但是没有用。

Does anybody know why it is happening and how to fix it? 有谁知道它为什么会发生以及如何解决它?

Any suggestions will be appreciated. 任何建议将不胜感激。 Thanks in advance. 提前致谢。

尝试更新离子,如果不起作用,可以通过genymotion读取控制台日志

install the app on android device, it only shows white blank page and does not work. 在Android设备上安装应用程序,它只显示白色空白页,但不起作用。

The big clue in this situation, is down to either a syntax error, missing script, or a dependency injection failure within the app.js . 在这种情况下,最大的线索是app.js的语法错误,缺少脚本或依赖注入失败。

On the Android platform, it is less forgiving in that aspect, as their chromium browser engine, is far more stricter then what would be on iOS's Webkit engine. 在Android平台上,它在这方面不那么宽容,因为他们的Chrome浏览器引擎比iOS的Webkit引擎更加严格。

The best weapon of defence is to use a lint tool for javascript, this will catch out the extraneous errors, a recommended way, would be to integrate it into the gulp script as a pre-build task for example, before doing an actual build. 最好的防御武器是使用一个lint工具用于javascript,这将捕获无关的错误,一种推荐的方法,就是在进行实际构建之前将其作为pre-build任务集成到gulp脚本中。

It can work out to be quite painful when doing a build deploy cycle, without using a lint tool, the extra time spent trying to figure out why a white blank screen greets you, only to realize a few minutes later, it was down to a slight mis-spelling. 在进行构建部署周期时可能会非常痛苦,不使用lint工具,花费额外的时间来弄清楚为什么白色的空白屏幕会给你打招呼,只有几分钟后才会意识到这一点,它已经归结为轻微的拼写错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM