Search code examples
angularcordovaandroid-emulatorcordova-pluginscordova-android

White Screen on Android Emulator


I get a blank screen on android emulator while the package deployment on the real device works fine.

Both the emulator and the real device are Nexus 6, Marshmallow.

The project is an Angular 5 app, default template created by running

ng new myproject
ng build --prod

With this configuration:

Angular CLI: 1.5.4
Node: 6.11.4
OS: darwin x64
Angular: 5.2.1

After that (the Angular outputs are inside www, where they are expected by Cordova), I run:

cordova build android

Output of which I deploy to the device without a problem, i.e. when I run the application, I see the default home page, but when I run

cordova emulate android

I see a blank screen without any error.

I had a similar behavior (blank screen) on iOS (emulator) but I got it working by setting

--base-href .

But looks like the Android plugin needs different treatment.

My main question is, how I can troubleshoot this kind of scenarios. Or maybe I'm doing something completely wrong.

On a final note

cordova emulate browser

works without any problem whatsoever, runs like the web app in the 'normal' browser instance. I would expect some level of transparency in Cordova plugin behavior, but this doesn't quite seem to be the case. I'm relatively new to this topic, so maybe somebody with more experience could guide me, would greatly appreciate.


Solution

  • Check Your Android Version. Sometimes Angular Projects need 4.4 above. If there are any API check before you run the application.