ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

Ionic 2 on android 4.1.2 show me a white screen

Open rpayanm opened this issue 10 years ago • 29 comments

I has a issue. Steps to reproduce:

  1. $ sudo npm install -g ionic@beta
  2. $ ionic start cutePuppyPics --v2 --ts
  3. $ ionic serve # everything good
  4. $ ionic platform add android
  5. $ ionic run android LAUNCH SUCCESS In the phone only I can see a white screen.
$ ionic info
Cordova CLI: 6.1.1
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.3
Ionic CLI Version: 2.0.0-beta.24
Ionic App Lib Version: 2.0.0-beta.14
OS: Distributor ID:     Debian Description:     Debian GNU/Linux 8.3 (jessie) 
Node Version: v4.4.1

Phone: Samsung Galaxy S2 T-Mobile - Android 4.1.2

rpayanm avatar Apr 04 '16 19:04 rpayanm

I'm getting this too on a Samsung Galaxy Note Mk I running 4.1.2. If I try running with --livereload --consolelogs I get a web page not available error page show up.

The app works in Chrome and on a Samsung Galaxy S5 running 5.0.

benjamintoddweb avatar Apr 11 '16 11:04 benjamintoddweb

https://github.com/driftyco/ionic-cli/issues/924 may be w duplicate of this

trb143 avatar Apr 12 '16 17:04 trb143

This may apply more to #924, but if the root cause is the same, this is because the webview version from Android 4.x and 5.x doesn't support native Set and Map. I enabled crosswalk and this error went away for me. I think the command is cordova plugin add cordova-plugin-crosswalk-webview

wli avatar Apr 12 '16 19:04 wli

An imrovement but now have Uncaught ReferenceError: Symbol is not defined lang.ts:449

trb143 avatar Apr 12 '16 19:04 trb143

What version of crosswalk did you install. I got it working with v17 and crosswalk plugin version 1.6.1. You should see this in your config.xml:

<preference name="xwalkVersion" value="17+"/>
<plugin name="cordova-plugin-crosswalk-webview" spec="~1.6.1"/>

And you can try to reset your environment by doing a ionic state reset

wli avatar Apr 12 '16 19:04 wli

That worked and the app is not working fine.

Thanks

trb143 avatar Apr 12 '16 19:04 trb143

I installed crosswalk and I still get a WSOD on 4.1.2. It's always worked on 5.0.

benjamintoddweb avatar Apr 13 '16 15:04 benjamintoddweb

I have the same issue, with the same android version 4.1.2. I got this error Uncaught TypeError: Cannot call method 'bind' of undefined, http://192.168.1.20:8100/build/js/app.bundle.js, Line: 63618 This is the line

exports.raf = (window[window['Zone']['__symbol__']('requestAnimationFrame')] || window[window['Zone']['__symbol__']('webkitRequestAnimationFrame')])['bind'](window);

It must be a problem with Zone. I changed this line to exports.raf = window.requestAnimationFrame(); I don't have the white screen anymore but I have some UI flaws like the back button in the navbar which is pushed to the right.

ThibaudD avatar Apr 14 '16 02:04 ThibaudD

+1 it work just on android 5.0 + not on the kitkat -

torst avatar Apr 22 '16 11:04 torst

Hello all! Have you all tried your apps with Crosswalk as @wli mentioned above? Although we do not officially support Android 4.1 (our official support stops at 4.2) installing Crosswalk might help. I am going to close this issue for now because as i stated, we do not officially support Android 4.1 at this time, but feel free to comment if your still having this issue and i will try to help. Thanks for using Ionic!

jgw96 avatar May 02 '16 17:05 jgw96

If you started your project before April, some of these problems will also be resolved by using angular2-polyfills and es6-shim. Check out the last few commits in one of the starter templates (https://github.com/driftyco/ionic2-starter-tabs/tree/4552fc4232434c0b122c0add1b5bfd4f929e0d47) to see how to get your app up to date.

index.html should have these lines, and a few other things get changed around:

  <!-- Polyfill needed for platforms without Promise and Collection support -->
  <script src="build/js/es6-shim.min.js"></script>
  <!-- Zone.js and Reflect-metadata  -->
  <script src="build/js/angular2-polyfills.js"></script>

wli avatar May 02 '16 18:05 wli

@wli Are those polyfills supposed to fix the issue on Android 4.1.2? I still got a white screen.

Heshyo avatar May 12 '16 11:05 Heshyo

Hello @Heshyo ! Are you using crosswalk? Just having those polyfills is not enough to make Ionic 2 work on Android 4.1.2. While we do support Android 4.1 and up, for anything below 4.4 we recommend that you use crosswalk as it gives you a modern, up to date chrome based webview that has the html5 and javascript support that ionic 2 needs. Thanks for using Ionic!

jgw96 avatar May 12 '16 15:05 jgw96

@jgw96 Actually I was only getting a white screen without CrossWalk on 4.1.2 and 4.2.2. On 4.4 it was fine. I searched for what version of Android and iOS Ionic2 supports, but I couldn't find anything in the doc (I did remember reading 4.1 and up somewhere). Using CrossWalk fixes the white screen problem.

So basically Ionic2 only works on Android 4.4 and up. And if I want to handle 4.0 to 4.3 (sadly still around 22% https://developer.android.com/intl/zh-cn/about/dashboards/index.html ), then I must use CrossWalk. If that's the case, it should definitely be written somewhere in the docs.

I'm fine using CrossWalk, actually it's nice to know that things will be the same everywhere. The only issue is that on one of my app (non Ionic), having CrossWalk makes the app crash on some low end devices (maybe they don't have enough memory).

Heshyo avatar May 13 '16 01:05 Heshyo

My ionic2 app is working fine in browser.

But Windows Phone build is not working fine. After installing XAP in Windows Phone , Splash screen is loaded and blank screen is shown.

Can anyone resolve it.

MadhuBalaC avatar Sep 12 '16 12:09 MadhuBalaC

@MadhuBalaC ho are you opening your WP project, visual studio?

endriazizi avatar Sep 15 '16 14:09 endriazizi

Hi guys, Hi try the to install from scratch ionic project with latest ionic release, I tried tu run on my android device 4.1.2 using cordova-plugin-crosswalk-webview and I got bad displaying app, about buttons navigation on the bottom and them doesn't work neither.

Any suggestion?

image

Your system information:                                                                                                                                                                        

Cordova CLI: 6.3.1                                                                                                                                                                              
Gulp version:  CLI version 3.9.1                                                                                                                                                                
Gulp local:                                                                                                                                                                                     
Ionic Framework Version: 2.0.0-rc.0                                                                                                                                                             
Ionic CLI Version: 2.1.0                                                                                                                                                                        
Ionic App Lib Version: 2.1.0-beta.1                                                                                                                                                             
OS:                                                                                                                                                                                             
Node Version: v6.7.0

config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="ent.mediaengine.virginrevolution" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>VirginRevolution App</name>
    <description>VirginRevolution</description>
    <author email="[email protected] " href="http://www.mediaengine.it/">Ionic Framework Team</author>
    <content src="index.html" />
    <access origin="*" />
    <access origin="*.pushwoosh.com" />
    <allow-intent href="fb:*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <allow-intent href="market:*" />
        <icon density="ldpi" src="resources\android\icon\drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources\android\icon\drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources\android\icon\drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources\android\icon\drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources\android\icon\drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources\android\icon\drawable-xxxhdpi-icon.png" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <icon height="57" src="resources\ios\icon\icon.png" width="57" />
        <icon height="114" src="resources\ios\icon\[email protected]" width="114" />
        <icon height="40" src="resources\ios\icon\icon-40.png" width="40" />
        <icon height="80" src="resources\ios\icon\[email protected]" width="80" />
        <icon height="120" src="resources\ios\icon\[email protected]" width="120" />
        <icon height="50" src="resources\ios\icon\icon-50.png" width="50" />
        <icon height="100" src="resources\ios\icon\[email protected]" width="100" />
        <icon height="60" src="resources\ios\icon\icon-60.png" width="60" />
        <icon height="120" src="resources\ios\icon\[email protected]" width="120" />
        <icon height="180" src="resources\ios\icon\[email protected]" width="180" />
        <icon height="72" src="resources\ios\icon\icon-72.png" width="72" />
        <icon height="144" src="resources\ios\icon\[email protected]" width="144" />
        <icon height="76" src="resources\ios\icon\icon-76.png" width="76" />
        <icon height="152" src="resources\ios\icon\[email protected]" width="152" />
        <icon height="167" src="resources\ios\icon\[email protected]" width="167" />
        <icon height="29" src="resources\ios\icon\icon-small.png" width="29" />
        <icon height="58" src="resources\ios\icon\[email protected]" width="58" />
        <icon height="87" src="resources\ios\icon\[email protected]" width="87" />
    </platform>
    <preference name="webviewbounce" value="false" />
    <preference name="UIWebViewBounce" value="false" />
    <preference name="DisallowOverscroll" value="true" />
    <preference name="android-minSdkVersion" value="16" />
    <preference name="BackupWebStorage" value="none" />
    <preference name="SplashScreenDelay" value="0" />
    <preference name="FadeSplashScreen" value="false" />
    <preference name="FadeSplashScreenDuration" value="0" />
    <preference name="SplashScreenBackgroundColor" value="0xFFFFFFFF" />
    <feature name="StatusBar">
        <param name="ios-package" onload="true" value="CDVStatusBar" />
    </feature>
    <plugin name="cordova-plugin-device" spec="~1.1.3" />
    <plugin name="cordova-plugin-console" spec="~1.0.4" />
    <plugin name="cordova-plugin-whitelist" spec="~1.3.0" />
    <plugin name="cordova-plugin-splashscreen" spec="~4.0.0" />
    <plugin name="cordova-plugin-statusbar" spec="~2.2.0" />
    <plugin name="ionic-plugin-keyboard" spec="~2.2.1" />
    <icon src="resources\android\icon\drawable-xhdpi-icon.png" />
    <plugin name="cordova-plugin-crosswalk-webview" spec="https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview.git">
        <variable name="XWALK_VERSION" value="21+" />
        <variable name="XWALK_LITEVERSION" value="xwalk_core_library_canary:17+" />
        <variable name="XWALK_COMMANDLINE" value="--disable-pull-to-refresh-effect" />
        <variable name="XWALK_MODE" value="embedded" />
        <variable name="XWALK_MULTIPLEAPK" value="true" />
    </plugin>
</widget>

package.json

{
  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "build": "ionic-app-scripts build",
    "watch": "ionic-app-scripts watch",
    "serve:before": "watch",
    "emulate:before": "build",
    "deploy:before": "build",
    "build:before": "build",
    "run:before": "build"
  },
  "dependencies": {
    "ionic-angular": "^2.0.0-rc.0",
    "ionicons": "^3.0.0",
    "@ionic/storage": "^1.0.3",
    "ionic-native": "^2.0.3"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^0.0.23",
    "typescript": "^2.0.3"
  },
  "description": "VirginRevolution: An Ionic project",
  "cordovaPlugins": [
    "cordova-plugin-device",
    "cordova-plugin-console",
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen",
    "cordova-plugin-statusbar",
    "ionic-plugin-keyboard",
    "cordova-plugin-crosswalk-webview"

  ],
  "cordovaPlatforms": [
     "android",
    "ios",
    "windows"
  ]
}

endriazizi avatar Sep 29 '16 11:09 endriazizi

Hi @endriazizi

I have same issue.

"I got bad displaying app using cordova-plugin-crosswalk-webview......"

Do you have found a solution?

Regards!

jbgomez21 avatar Nov 03 '16 17:11 jbgomez21

@endriazizi @jbgomez21 I have Android 4.1.2 and my app works well with XWalk (I'm still in one of the latest beta, not yet RC).

Was it working well for you with previous Ionic versions? Or can it be that a newer XWalk version messes things up?

Heshyo avatar Nov 04 '16 00:11 Heshyo

In my case I need Android 4.2.2, I try: ionic start myapp -t blank --v2

add in config.xml <preference name="android-minSdkVersion" value="17" /> <preference name="xwalkVersion" value="17+"/> <plugin name="cordova-plugin-crosswalk-webview" spec="~1.6.1"/>

ionic state reset ionic platform add android ionic build android --release

*** ERROR ****

:compileArmv7ReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).

C:\Users\diou_\OneDrive\www\thebest\theBestAtendente\platforms\android\src\org\crosswalk\engine\XWalkWebViewEngine.java:47: error: XWalkWebViewEngine is not abstract and does not override abstract method evaluateJavascript(String,ValueCallback) in CordovaWebViewEngine

public class XWalkWebViewEngine implements CordovaWebViewEngine {

   ^

Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details. 1 error

:compileArmv7ReleaseJavaWithJavac FAILED

BUILD FAILED

Total time: 34.11 secs

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':compileArmv7ReleaseJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Error: cmd: Command failed with exit code 1 Error output: Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. C:\Users\diou_\OneDrive\www\thebest\theBestAtendente\platforms\android\src\org\crosswalk\engine\XWalkWebViewEngine.java:47: error: XWalkWebViewEngine is not abstract and does not override abstract method evaluateJavascript(String,ValueCallback) in CordovaWebViewEngine public class XWalkWebViewEngine implements CordovaWebViewEngine { ^ Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. 1 error

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':compileArmv7ReleaseJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

ionic info

Your system information:

Cordova CLI: 6.4.0 Ionic Framework Version: 2.0.0-rc.3 Ionic CLI Version: 2.1.13 Ionic App Lib Version: 2.1.7 Ionic App Scripts Version: 0.0.45 ios-deploy version: Not installed ios-sim version: Not installed OS: Windows 10 Node Version: v6.9.1 Xcode version: Not installed

dioubernardo avatar Nov 27 '16 04:11 dioubernardo