Capacitor livereload not working
Asked Answered
P

5

10

I can't figure out how to use livereload with ionic 4 and Capacitor on ios.

I'm running this command ionic cap run ios -l which add my local ip address to capacitor.config.json.

however, it seems like I'm missing something in here.

Note: according to Provide live-reload functionality #3130 this should work.

my environment setup:

Ionic:

   ionic (Ionic CLI)          : 4.1.0 (/usr/local/lib/node_modules/ionic)

   Ionic Framework            : @ionic/angular 4.0.0-beta.2

   @angular-devkit/core       : 0.7.3

   @angular-devkit/schematics : 0.7.3

   @angular/cli               : 6.1.3

   @ionic/ng-toolkit          : 1.0.6

   @ionic/schematics-angular  : 1.0.5

Capacitor:

   capacitor (Capacitor CLI) : 1.0.0-beta.6

   @capacitor/core           : 1.0.0-beta.6

System:

   NodeJS : v9.10.1 (/usr/local/bin/node)

   npm    : 6.4.0

   OS     : macOS High Sierra
Periderm answered 16/8, 2018 at 15:48 Comment(1)
thanks to Julio Cesar for pointing this out, this turned to be a bug in Capacitor which has a PR already github.com/ionic-team/capacitor/pull/741 and github.com/ionic-team/capacitor/pull/742Periderm
P
5

Thanks to Julio Cesar form ionic team for pointing this out, this turned to be a bug in Capacitor which has a PR already github.com/ionic-team/capacitor/pull/741 and github.com/ionic-team/capacitor/pull/742

Periderm answered 16/8, 2018 at 18:25 Comment(1)
this is now merged and released in 1.3.0Iconoclasm
D
14

For those still struggling with his try:

ionic capacitor run ios --livereload --external

It will open Xcode automatically. Run your project and livereload should work.

Make sure that you are connected to the same WiFi on your device and computer.

Dippy answered 9/10, 2019 at 14:24 Comment(1)
For anyone using latest ionic version 7 and capacitor v5 you need to install the JDK-17 here is the link oracle.com/java/technologies/javase/… don't forget to update the environment variables>system variables>JAVA_HOME = [path location of JDK in my case it is C:\Program Files\Java\jdk-17] and restart your terminal or code editor to take effect. Link for ionic capacitor for anyone is looking ionicframework.com/docs/cli/….Lapham
P
5

Thanks to Julio Cesar form ionic team for pointing this out, this turned to be a bug in Capacitor which has a PR already github.com/ionic-team/capacitor/pull/741 and github.com/ionic-team/capacitor/pull/742

Periderm answered 16/8, 2018 at 18:25 Comment(1)
this is now merged and released in 1.3.0Iconoclasm
S
1

It didn't work for me as well until I added "cleartext": true to capacitor.config.json under server. Like this:

"server": {
  "url": "http://192.168.1.68:8100",
  "cleartext": true
}

This is explained in the official documentation under Using with Framework CLIs.

Snooker answered 21/8, 2020 at 8:49 Comment(0)
H
1

Your assets may need to be rebuilt & plugins resynced.

npm run build
ionic cap sync

Sync will tell you if your Capacitor version matches your platform versions and if there are any issues with plugins.

Then livereload run with:

  • ANDROID:
ionic cap run android -l --external
  • iOS:
ionic cap run ios -l --external
Hardboard answered 15/10, 2021 at 2:21 Comment(0)
B
1

You can match below json with your capacitor.config.ts and then run

ionic cap run android -l --external

{
  appId: 'com.app.android,
  appName: 'MYapp',
  webDir: 'www',
  android: {  },
  ios: {  },
  plugins: {
    CapacitorHttp: {
      enabled: true,
    },
  },
  server: {
    androidScheme: 'https',
    url: "http://192.168.1.68:8100",
    cleartext: true
  },
  bundledWebRuntime: false,
  loggingBehavior:'debug',
}
Buckling answered 22/3 at 9:8 Comment(1)
I think inside server url, androidScheme and cleartext is enough to start live reload. By the way its working fine. Thank you.Dovetailed

© 2022 - 2024 — McMap. All rights reserved.