question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cordova-serve-android is pointing to wrong ip

See original GitHub issue

I have a few virtual network cards, and when serving from android, it’s getting the wrong IP, probably from the function address.ip()

When running cordova-serve-android, I see this line: updating cordova config.xml content to http://192.168.56.1:8080 while my actual IP is 10.0.0.4.

This is the output of ipconfig:

Windows IP Configuration


Ethernet adapter VirtualBox Host-Only Network:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::38bb:d8:1abc:b66f%12
   IPv4 Address. . . . . . . . . . . : 192.168.56.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :

Wireless LAN adapter Local Area Connection* 3:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Local Area Connection* 1:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Ethernet adapter VMware Network Adapter VMnet1:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::2130:a805:1ef6:d328%2
   IPv4 Address. . . . . . . . . . . : 192.168.187.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :

Ethernet adapter VMware Network Adapter VMnet8:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::65ed:ae22:2042:7e31%21
   IPv4 Address. . . . . . . . . . . : 192.168.127.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :

Wireless LAN adapter Wi-Fi:

   Connection-specific DNS Suffix  . : Home
   Link-local IPv6 Address . . . . . : fe80::946a:4696:6997:816f%8
   IPv4 Address. . . . . . . . . . . : 10.0.0.4
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 10.0.0.138

I tried configuring “host” in vue.config.js file:

devServer: {
    host: '10.0.0.4'
  }

This fixes npm run serve but is ignored in cordova-serve-android.

I’m happy to PR if you think this is a bug. Thanks.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
m0dch3ncommented, Dec 24, 2018

ok, thank you for sharing the information… If I find some time, I’ll maybe investigate to start a prompt, if there are multiple IPs…

1reaction
JakubHromadacommented, Apr 7, 2020

I’m running win 10 and changing the adapter priority to 1 solved the The connection to the server was unsuccesful (https://"192.168.56.1:8080") I can now run npm run cordova-serve-android with no issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Simulator how does it connect to local IP addresses?
The emulator points to the live network and not the local network in my company. This is strange and I know that I...
Read more >
Config.xml - Apache Cordova
This changes what happens when the app is launched from app icon or intent and is already running. AndroidXEnabled(string) ==Android== Default: false. Sets...
Read more >
Using Cordova 6.x with Ionic
Add the Scandit Data Capture SDK for Cordova · 1. Download our Scandit Cordova 6. · 2. Delete the following line in the...
Read more >
Mobile App Build Commands | Quasar Framework
quasar/app-vite) The Quasar CLI list of commands when developing or building a hybrid mobile app with Cordova.
Read more >
cordova-plugin-ping - npm
Although the object is in the global scope, it is not available until after the deviceready event. Ping a domain. query : Domain...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found