Problem: Application works on 'serve lab' but not on android device

Hi everyone!

I´ve been programming an application with ionic framework and I have found a little issue.

When I test my code with the “ionic serve --lab” instruction everything works fine (not even one javascript failure).

The problem starts when I try to run it on a real device: the only thing that appears is the content of the index.html withouth any style; a white screen with the title in black.

Any suggestions?
Thank you.

Óscar Ruiz.

Try running with

ionic run --livereload --consolelogs android

and you should at least see if it’s logging any errors.

(Type ionic help run to see what other options you can pass.)

Thanks for the answer!
I have tried to run this one and I always get an “Application Error The connection to the server was unsuccesfull(http://…)” even using it on example applications.

Maybe you’re missing the cordova-plugin-whitelist that restricts http requests.

Can you type ionic info and ionic plugin list and paste the output here?

Seems like I only have one plugin installed
’ com.ionic.keyboard 1.0.4 “Keyboard” ’

You should have more than just the keyboard plugin. Check which version of the Ionic CLI you have by typing ionic info. You’ll see something like

Your system information:

Cordova CLI: 5.1.1
Ionic Version: 1.0.0
Ionic CLI Version: 1.5.2
...

If you have an old version upgrade with npm update -g, then try creating a new project.

Sorry, that was the response of plugins.

ionic info

Your system information:

Cordova CLI: 5.1.1
Ionic Version: 1.0.0
Ionic CLI Version: 1.5.0
Ionic App Lib Version: 0.1.0
OS: Windows 7 SP1
Node Version: v0.12.0

Did you add android support to the project with ionic platform add android? What steps did you follow exactly?

Yes.

I just created a new ionic project just to test if it was mine that was corrupted.

ionic start myApp tabs

Then I tested it with the ionic serve lab while I add new functionallity and finally, I used “ionic build android && ionic run android”.

In this moment I get the same error when I try to run “ionic run --livereload --consolelogs android” (the connection to the server was unsuccesful…").

I just realized that if instead of having wifi connection Im using 4G the screen goes blank and nothing happens.

Yes, you do need to make sure your device is connected to the same network as your computer for --livereload to work.

Try npm update -g to make sure you have the latest Ionic CLI version.

1 Like

Thank you very much for the help encodedmirko!

My issue was that I was working in two different networks.