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

CLI v3: Live reload doesn't work on device for Ionic 1

Open fiznool opened this issue 9 years ago • 12 comments

Short description of the problem:

When running an Ionic 1 project on an Android device, trying to use live reload results in an Application Error. The same issue occurs for iOS too.

What behavior are you expecting?

Live reload to work as it used to with the CLI v2.

Steps to reproduce:

  1. Start a new Ionic 1 project with v3 of the CLI: ionic start myapp blank --type ionic1
  2. cd myapp
  3. cordova platform add android
  4. Connect Android device
  5. ionic cordova run android

The app fails to load. See screenshot below. Seems like the port isn't being set properly (undefined)?

screenshot_20170513-215810

Post the output of ionic info below please

global packages:

    @ionic/cli-utils : 1.0.0
    Cordova CLI      : 7.0.1
    Ionic CLI        : 3.0.0

local packages:

    @ionic/cli-plugin-cordova : 1.0.0
    @ionic/cli-plugin-ionic1  : 1.0.0
    Ionic Framework           : ionic1 1.3.3

System:

    Node       : v6.10.3
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.2 Build version 8E2002
    ios-deploy : 1.9.1
    ios-sim    : 5.0.13

fiznool avatar May 13 '17 21:05 fiznool

I can also confirm that this issue also occurs with iOS devices. The app boots into the splashscreen but then hangs.

fiznool avatar May 13 '17 21:05 fiznool

@fiznool I've seen this issue mentioned before, but I've never been able to reproduce it. Could you debug a little more? Is your app version controlled? If so, check the changes to config.xml before and after running ionic cordova run android. We change the content src in the XML.

imhoffd avatar May 15 '17 20:05 imhoffd

Should be fixed in @tlancina's commit! Thanks!

imhoffd avatar May 15 '17 22:05 imhoffd

Hi @dwieeb, I have the same problem with this issue.

I have been working in an ionic v1 project in the last 2 months and when I upgrade the CLI to v3 the app does not pass the splash screen anymore. When I run the app with the -c flag, the console doesn't show up any error, it simply shows the "BUILD SUCCESSFUL" message and stays there.

Something strange that I noticed is the src property in the config.xml content tag with an undefined port:

<content original-src="index.html" src="http://192.168.1.101:undefined" />

I tried run the app with --livereload-port and add a port manually but nothing change in the config.xml.

Then after a while, shows up this error:

screenshot_20170516-113327

Ionic info details:

global packages:

    @ionic/cli-utils : 1.0.0
    Cordova CLI      : 7.0.1 
    Ionic CLI        : 3.0.0

local packages:

    @ionic/cli-plugin-cordova : 1.0.0
    @ionic/cli-plugin-ionic1  : 1.0.0
    Ionic Framework           : ionic1 1.3.3

System:

    Node       : v7.7.3
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.2 Build version 8E2002 
    ios-deploy : 1.9.1 
    ios-sim    : 5.0.13 

juanhenriquez avatar May 16 '17 15:05 juanhenriquez

@juanhenriquez As I mentioned, this was just fixed. It will be in the next release.

imhoffd avatar May 16 '17 16:05 imhoffd

Still not working properly with the new CLI 3.3.0.

Console logs are still not visible too.

Ionic info details

global packages:

@ionic/cli-utils : 1.3.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.3.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-cordova       : 1.3.0
@ionic/cli-plugin-ionic-angular : 1.3.0
Cordova Platforms               : android 6.2.3 ios 4.4.0
Ionic Framework                 : ionic-angular 3.3.0

System:

Node       : v6.10.3
OS         : macOS Sierra
Xcode      : Xcode 8.3.2 Build version 8E2002
ios-deploy : 1.9.1
ios-sim    : 5.0.8

Borongaj avatar Jun 01 '17 13:06 Borongaj

I am same error for @Borongaj . Don't show console and server logs. I was reinstall cordova plugin console and nothing. Console logs don't show im iOS Simulator and Android Emulator. When i run ionic serve -l, works

Ionic Info Details ` global packages:

@ionic/cli-utils : 1.3.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.3.0

local packages:

@ionic/cli-plugin-cordova : 1.3.0
@ionic/cli-plugin-ionic1  : 1.3.0
Cordova Platforms         : android 6.2.3 ios 4.4.0
Ionic Framework           : ionic1 1.3.3

System:

Node       : v7.10.0
OS         : macOS Sierra
Xcode      : Xcode 8.3.2 Build version 8E2002
ios-deploy : 1.9.1
ios-sim    : 5.0.13

`

pedrobrasileiro avatar Jun 05 '17 05:06 pedrobrasileiro

@Borongaj @pedrobrasileiro Those are separate from the original issue (port undefined), which was fixed.

I think you both are having this issue: https://github.com/ionic-team/ionic-cli/issues/2168 (which I still haven't been able to reproduce)

imhoffd avatar Jun 05 '17 23:06 imhoffd

Thanks dwieeb.

But console logs are not working when using iOS too...

Borongaj avatar Jun 06 '17 09:06 Borongaj

I am also having issues with live reload not working. I create and try to run a new v1 app with:

ionic start newIonicV1 blank --type=ionic1
cd ./newIonicV1
ionic cordova platform add android

and finally

ionic cordova run -l -c -s --device

CLI output stops at LAUNCH SUCCESS. On my device, I get The connection to the server was unsuccessful.

My ionic info:

➜ ionic info                         

global packages:

    @ionic/cli-utils : 1.3.0
    Cordova CLI      : 7.0.1 
    Ionic CLI        : 3.3.0

local packages:

    @ionic/cli-plugin-cordova : 1.3.0
    @ionic/cli-plugin-ionic1  : 1.3.0
    Cordova Platforms         : android 6.2.3
    Ionic Framework           : ionic1 1.3.3

System:

    Node       : v7.2.0
    OS         : macOS Sierra
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed

Does someone have an idea on how to fix this? I'm pretty much lost. Thanks!

simonedavico avatar Jun 06 '17 15:06 simonedavico

@simonedavico Look at the IP it's using. If your device can't access that IP, then the connection will be unsuccessful. Make sure your device is on the same wifi of your computer.

If that doesn't work, you can ask stack overflow or the forums. This is a bug report and unrelated to your issue.

imhoffd avatar Jun 06 '17 17:06 imhoffd

@dwieeb thanks for answering! The ip looks correct. If I access it from my desktop browser the app loads. Also, both devices are on the same WiFi networks, because I have only one. The only thing I did not try was accessing the live server address from the device's browser.

How can I make sure this problem is not related to this bug report? Unlike @fiznool, I see the right port number, but behaviour is exactly the same.

simonedavico avatar Jun 06 '17 17:06 simonedavico