App not running in debug mode on Android device

Hey Ionic devs! I’ve an issue to run my android version of my app in debug mode (with my android device connected to my computer). The weird fact is that it’s working well when I’m using an apk generated by a build …
I’ve try to look at the adb logcat but I haven’t found any clue.
My device is a nexus 5 on the 5.0.1v of android. Is Anybody have an idea because it’s ruining my day ?

Are you trying to run it with -l (livereload) flag? if so, then make sure that your device and your computer are on the same network

yes I’m loading it with -cls options in order to do an effective debug. But I’m sure both my device and my computer are on the same network.

Anyway thanks for the try :wink:

Hmm, could you provide any more info?
Does the app launch at all?

The app is correctly built and installed on the device but when the device lauch it it displayed a black screen.
The weird fact is it’s launched correctly when it’s install via the apk file but when I tried to launch the debug when my device is connected to the computer it’s only show a black screen. If you want I can give you the adb logcats ?

Hmm, could you try this with a blank starter project? Lets narrow this down to maybe something in your project or an issue with cordova

I’ve been incrementally having this issue as well. Yesterday it seemed to be working, today I updated to the new ionic cli and it started doing this again.

I have a samsung tablet plugged in. It seems to be related to the live reload, particularly this line in config.xml which is auto-generated:

<content original-src="index.html" src="" />

That network address appears to be attached to virtual box:

vboxnet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 0a:00:27:00:00:00 
inet netmask 0xffffff00 broadcast

Whereas my standard network interface is this:

ether 14:10:9f:e1:23:65 
inet6 fe80::1610:9fff:fee1:2365%en0 prefixlen 64 scopeid 0x4 
inet netmask 0xffffff00 broadcast
nd6 options=1<PERFORMNUD>
media: autoselect
status: active

I’m not sure what prompted that vbox interface. I do have Genymotion installed so that may be it. I do also use Virtual Box + Vagrant for development, although I do not have any of my vagrant images up at this time.

It seems the tablet is just having a hard time resolving that network. It is in the network so I don’t think it can reach the vbox interface.


So, if I run without --livereload, it loads ok, as expected. I’m guessing the live-reload scans the output of the operating system’s list of network interfaces, and posed with multiple interfaces, it just tries to intelligently choose one, which doesn’t always work.

How can I get it to pick the correct interface?

One quick fix for me to get past this:

$ sudo ifconfig vboxnet0 down

But this isn’t ideal since then I cannot use virtual box. @mhartington please advise: is it possible to configure live reload dynamically or otherwise for a particular interface?

Hum seems to work when I run the app without the livereload (ionic run android -cs) but the weird thing is I don’t have console logs or server logs with that command …
Is this logs are relatives to livereload ?

(Anyway thanks a lot for the help zenocon)

@sweetwingz did you run as ionic run android -c -s ?

If you did launch and are missing the console or server logs, you can dynamically toggle them on/off in the console by just typing the first letter: c or s. This has always worked for me.

I was running the app on my device like this : ionic run android -cs
I tried your way and it’s doing the same thing:

Total time: 19 seconds
Built the following apk(s):
WARNING : No target specified, deploying to device ‘05f41fdb0a2326e1’.
Using apk: /Users/benjaminroullet/Documents/workspace/wingz-mobile/platforms/android/ant-build/CordovaApp-debug.apk
Installing app on device…
Launching application…

And after that the app is lauched on the device but I’m not able to see logs from it or from the server …

I believe you need to be running against the livereload server for the console logs to work. I run -l for livereload then when I need console logs, go back to my console and hit c then enter. you can do the same for server logs

Ok but as you can read above, I can’t run my app on my device with the livereload …

I have same problem only if I come to office and my phone accidently connects to different wifi from my laptop!

One solution is that I can think of which is not ideal, but you can still try it. If you are on mac, share your wired internet as a wifi hotspot from mac, and connect to it from your phone.

Not really ideal indeed, I need access to my network. However my phone is on the same wifi so I don’t think that the problem is relative to this.

Anyway thanks for your answer.

Ahhh got ya. Are you making any cross domain requests in your app? When livereload first came out I was running into CORS issues because my app makes cross domain requests. Configuring a proxy in ionic.project fixed my issue, but your issue might be different than mine.

Hey thanks you for your answer, we do use cross domain requests so I set a proxy in ionic.project but nothing changed.

Did you tried on emulator?

It work well with genymotion but I’d like to do an effective debug on my device.