Livereload for android on device; the connection to the server was unsuccessful


#1

I cannot get my live reload to work on my android device. I tried setting up my phone to be on the same wifi, used the --lc flag, tried to use the --livereload-host flag, tried to add to my config xml several flags for origin=* and changing my content src=“the_dev_server_ip”, and various other things.

I really need to be able to test native plugins in real time. What do I need to do to get my live reload to work? What info do you guys need me to give you so I can accomplish this?

Thanks.


RC.1 - problems on actual device (timeout + no css)
#2

use this option
-l -c
might be you need to connect the mobile with the system

for command wise help type ionic --help for further details


#3

I used both of those flags and tried using a USB connection but it didn’t work


#4

can you provide your command here please


#5

sudo ionic run android --device -lc


#6

ionic run android --device -l -c
well please try this also if possible use the target option


#7

The error I get when run that command is

"The connection to the server was unsuccessful. (http://140.254.160.122:8101)


#8

seems this is a loadUrlTimeoutValue issue

try to use a splash screen,
using ionc resources apply it
and rerun the command


#9

i ran the commands in the app.component.ts constructor the following:

  Splashscreen.show();

  Splashscreen.hide();

and I got the same error.

I didn’t even see the splash screen come up.


#10

you don’t need to explicity call it,
just configure using ionic resources command


#11

What does that mean exactly. Please give me an example.


#12

http://ionicframework.com/docs/cli/icon-splashscreen.html
please see this link
try emulate your application in an android platform first then try it in the device,


#13

I tried it in the device and I saw just a black screen with no splash screen.


#14


see this thread


#15

When using livereload you cant do that through USB. You have to connect your phone to the same network as your computer that serves - where ionic serve/run are running.


#16

I am connected to the same public wifi, but on my Mac how do I connect to the same network?

I am trying to test the app natively so I can run the native plugins but use live reload so I can develop as quickly as possible. However, I also need to be able to avoid CORS errors which is why I have been trying to use the app on my device but still have the live reload. How do I do this?


#17

Just to be more specific in getting help, the I am getting the following error message when running ionic run android --device -l

Application Error.
"The connection to the server was unsuccessful. (http://ipaddress_here:8100)


#18

Any solution for this? I am stuck with this issue. can anyone from ionic team help here?
@mhartington

Device is running on 4.4.4, ionic info is below

Your system information:

Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.1
Ionic CLI Version: 2.1.1
Ionic App Lib Version: 2.1.1
Ionic App Scripts Version: 0.0.36
ios-deploy version: 1.8.6 
ios-sim version: 5.0.8 
OS: Mac OS X Sierra
Node Version: v4.6.0
Xcode version: Xcode 8.0 Build version 8A218a

#19

Same as @maruti here.

It worked fine until I upgraded to RC.1.

Now it works fine only on chrome, when trying it on an actual android device it gives "the connection to the server was unsuccessful (file:///android_asset/www/index.html)

In my case I compile apps via Adobe Build copying www folder.

May this have something to do with main.dev.ts and main.prod.ts ?

Ionic Team please help us.

I spent a lot of time to refactor my app from beta to rc, it would be really frustrating if I had to get back to beta because I’m not able to run it on actual device


#20

Ok, at least for my case I found the problem and the solution.

The app is pretty fast (as it was beta 11) once loaded, but it’s incredibly SLOW while loading (25 seconds to load on a Galaxy J1 2016 !!!) and it exceeds default android timeout.

To solve put in your config.xml something like:

<preference name="loadUrlTimeoutValue" value="700000" />

this will let your app load correctly even if after that enormous startup time.