How to access localhost from a NOX app player android emulator? - android

I need to get access to my wamp server localhost from NOX app player.
Which link I could use to get it. the 10.0.2.2 not working with it...

I found the IP to be 172.17.100.2. Found this out by installing the Android "Fing" app to browse the network and tried the first result. Works great. Not sure why NOX didn't stick with the usual 10.0.2.2 like most other emulators I've used.

With NOX 3.7.0 I can connect to host machine using 192.168.56.1.
It listed in ipconfig /all (I use windows 10)

Use your machines ip address if you are connected to a network e.g 10.70.10.3 instead of using 127.0.0.1/localhost
credit: sechanakira's comment
This has worked for me. My machine is connected to a LAN.
Steps:
Run ipconfig to get my IP.
Replace 127.0.0.1 with my IP in NOX app player

NOX 3.7.6.3.I use PC's ip and port number (for example 192.168.0.200:80).
ip from ipconfig, port - whatever you set for your localhost(80 by default).
And it works with Nox app player 6.2.5.3.

This is working for Genymotion. Try to change your IP to http://10.0.3.2/ instead 10.0.2.2. Reply whether this works or not.

Related

Unable to connect to an external database [duplicate]

I try to browse localhost on my HTC Magic. I have connected my device with Eclipse via USB. When browsing http://10.0.2.2 I get "Page not available". I remember, some days ago it worked.
But on the emulator I am able to browse localhost
Any ideas?
Easier way to check is in browser of emulator type 10.0.2.2 instead of localhost.
I use my local ip for that i.e. 192.168.0.1 and it works.
to access localhost on emulator: 10.0.2.2. However this may not always work for example if you have something other than a web server such as XMPP server.
assuming that you're on the same wireless network...
find your local ip (should be something 192.168.1.x) - go to the command line and type 'ipconfig' to get this. where x is the assigned local ip of the server machine.
use your local ip for your android device to connect to your localhost.
it worked for me.
If you want to access a server running on your PC from your Android device via your wireless network, first run the command ipconfig on your PC (use run (Windows logo + R), cmd, ipconfig).
Note the IPv4 address: (it should be 192.168.0.x) for some x. Use this as the server IP address, together with the port number, e.g. 192.168.0.7:8080, in your code.
Your Android device will then access the server via your wireless network router.
I needed to see localhost on my android device as well (Samsung S3) as I was developing a Java Web-application.
By far the fastest and easiest way is to go to this link and follow instructions: https://developer.chrome.com/devtools/docs/remote-debugging
* Note: You have to use Google Chrome.*
My summary of the above link:
Connect PC with Phone over USB.
Turn on Phone's "Developer options" from Settings
Go to about:inspect URL in PC's browser
Check "Discover USB Devices" (forward Ports if you are using them in your web-application)
Copy/paste localhost required link to text field in browser and click Open.
Piece of cake
You can get a public URL for your server running on a specific port on localhost.
At my work place I could access the local server by using the local IP address of my machine in the app, as most of the other answers suggest. But at home I wasn't able to do that for some reason. After trying many answers and spending many hours, I came across https://ngrok.com. It is pretty straight forward. Just download it from within the folder do:
ngrok portnumber
( from command prompt in windows)
./ngrok portnumber
(from terminal in linux)
This will give you a public URL for your local server running on that port number on localhost. You can include in your app and debug it using that URL.
You can securely expose a local web server to the internet and capture all traffic for detailed inspection. You can share the URL with your colleague developer also who might be working remotely and can debug the App/Server interaction.
Hope this saves someone's time someday.
Combining a few of the answers above plus one other additional item solved the problem for me.
As mentioned above, turn your firewall off [add a specific rule allowing the incoming connections to the port once you've successfully connected]
Find you IP address via ipconfig as mentioned above
Verify that your webserver is binding to the ip address found above and not just 127.0.0.1. Test this locally by browsing to the ip address and port. E.g. 192.168.1.113:8888. If it's not, find a solution. E.g. https://groups.google.com/forum/?fromgroups=#!topic/google-appengine-java/z4rtqkKO2hg
Now test it out on your Android device. Note that I also turned off my data connection and exclusively used a wifi connection on my Android.
Mac OSX Users
If your phone and laptop are on the same wifi:
Go to System Preferences > Network to obtain your IP address
On your mobile browser, type [your IP address]:3000 to access localhost:3000
e.g. 12.45.123.456:3000
If your localhost is not running on the default HTTP port(which is port 80), you need to specify the port in your url to something that corresponds to the port on which your localhost is running. E.g. If your localhost is running on, say port 85, Your url should be
http://10.0.2.2:85
For the mac user:
I have worked on this problem for one afternoon until I realized the Xampp I used was not the real "Xampp" It was Xampp VM which runs itself based on a Linux virtual machine. That made it not running on localhost, instead, another IP. I installed the real Xampp and run my local server on localhost and then just access it with the IP of my mac.
Hope this will help someone.
If your firewall is on, turn it off and use IPv4 to test your app in the actual device, then test your application.
I had similar issue but I could not resolve it using static ip address or changing firewall settings. I found a useful utility which can be configured in a minute.
We can host our local web server on cloud for free. On exposing it on cloud we get a different URL which we can use instead of localhost and access the webserver from anywhere.
The utility is ngrok https://ngrok.com/download
Steps:
Signup
Download
Extract the file and double click to run it, this will open a command prompt
Type "ngrok.exe http 80" without quotes to host for example XAMPP apache server which runs on port 80.
Copy the new url name generated on the cmd prompt for e.g. if it is like this "fafb42f.ngrok.io"
URL like : http://localhost/php/test.php
Should be modified like this : http://fafb42f.ngrok.io/php/test.php
Now this URL can be accessed from phone.
I use testproxy to do this.
npm install testproxy
testproxy http://10.0.2.2
You then get the url (and QR code) you can access on your mobile device. It even works with virtual machines you can't reach by just entering the IP of your dev machine.
I used ngrok but now it need registration and it also has a connections request limit. Now I'm using LocalTunnel and so far it's much better.

How to access WIFI server in Genymotion emulator

I want to connect android device to WIFI server. I can do it in AVD and real device with success, but can't give any result in Genymotion. I use 192.168.1.100 for server.
Access host from Genymotion emulator
In this link somebody said try 10.0.3.2 and i did it but the result not changed and still can't access server in Genymotion.
You can try your computer ip adress.
Open cmd and write ipconfig and try IPv4 adress.
I hope it will work.

How to access localhost from a Genymotion android emulator?

I can not figure out how to access localhost from a Genymotion android emulator. By the way, Im using MAMP.
Update
After genymotion update to 2.2 you can use 10.0.3.2, ref
Another approach
To access your localhost through Genymotion is using your PC IP address. to get your IP address go to:
start -> cmd -> ipconfig
then search for IPv4, copy the IP and paste it in your URL. It should looks like the following:
String YourURL = "http://192.168.0.106:8888/your_script_location.php";
Hope this works too for you, give me a feedback.
P.S: if it didn't work, turn off the firewall and any anti-virus application you have in your PC.
you need this structure
Genymotion
http://10.0.3.2/
Default AVD
http://10.0.2.2/
the http it's very important and the port it's for default It depends on your server.
you can check this url in your browser the smartphone
The IP returned by ipconfig dit not work for me. However 10.0.3.2 worked for me even though the IP address in the Wifi setting is 10.0.3.15.
Genymotion 2.2.0
it works for me by using http://192.168.56.1:8080
to know your IP just use the following command
for
(mac and linux) ifconfig vboxnet0
windows command ipconfig vboxnet0
and make sure the port is collect.
I got the answer from : here
Genymotion! It works for me using IP 10.0.3.2 but depends on your localhost port. Apache it will be just IP and Tomcat with default port 8080. Here I take screenshots.
1. Apache Screenshot
2. Tomcat Screenshot
Hope this is helpful. Thanks!
Intro:
Long story short, Genymotion is running on Virtualbox, and the default network configuration is “Host-Only.” This method essentially emulates a physical network that is shared by your Genymotion VM (the emulator) and your host machine. The name of the network is vboxnet0, and if you run “ifconfig vboxnet0” (or “ipconfig vboxnet0” if running Windows) on your host machine, you should receive the IP address of your host on the vboxnet0 network. The default IP is most likely 192.168.56.1.
Solution:
This is the IP address to use when accessing your host machine from the Genymotion emulator. For my Rails app, this meant calling “192.168.56.1:3000” instead of “10.0.2.2:3000.”
Link:
http://bbowden.tumblr.com/post/58650831283/accessing-a-localhost-server-from-the-genymotion
run xampp(def 127.0.0.1:80) and go to Control Panel\All Control Panel Items\Network and Sharing Center
select connection
When i used genymotion in my ubuntu
i used the ip address of the virtual machine as local host and it worked .
in virtual box goto file > preferences > network > select host only network and select adapter tab copy the ipv4 address and use it instead of localhost ...
like http://192.168.56.1/qrstuff/json/
Check your Internet Connection on PC first,
then Turn on Wifi in your Genymotion Emulator Device
After goto Cmd by Pressing ctrl+r then type Cmd and hit enter you will see an command line window
type ipconfig and hit enter...
here you can see your ipv4 address type it in your Genymotion Emulator Device's Browser now you can connect to your local webserver....
In my case 10.0.3.2 didn't work. I changed to virtual box host-only network : 192.168.128.2 it works.
You have to try other virtualbox adapters IP if it doesn't work with 192.168.56.1.
My environment is behind a corporate proxy and I was running an embedded undertow server.
Hope it helps.

How to access the wamp localhost in android device for testing?

In emulator am use this 10.0.2.2 ip address to test the application it work fine,but it not work for testing in android device.am connect the device through USB cable.How to test the app in device with local host.Can anyone know help me.
Start Wamp server on pc
Click Wamp windows taskbar
Click "Put Online" (bottom of wamp)
Run command prompt
type ipconfig and enter
Note your IPv4 address (192.168.1.206 in my case)
Make sure your pc and android connect with same wifi
Make sure your wifi network as "Home Network"
Open browser on android
Type your IPv4 address
I hope this help.
use The WIFI That is The Best Solution of your Problem..And Use Your IP Address for Connection ...from android device to the local server..:-)
USB won't provide network to you.
Hope this will help you.
How can I access my localhost from my Android device?
use Connectify Software, and insert the IP address of the system, in your android code instead of 10.0.0.2.
For Windows 10 Users
go to Control Panel-> System and Security->Windows Defender Firewall->Turn Windows Defender Firewall on or off.
Set both private and public network settings to off.
open a command prompt. type ipconfig and note your IP.
on your android device open a browser and type in your pc's IP.
I used this with WIFI and it worked fine.

Accessing intranet in Android emulator

I'm trying to test an intranet site in the Android emulator, but I can't seem to get the emulator to access our intranet. For example, the site I'm trying to access is at http://compass/messages, but trying that page in the browser gives me a Google search result page instead of the intranet site.
I can access the INTERNET with the emulator, but not the INTRANET. I can access the intranet from the host machine, and from the iPhone simulator on the same machine.
I'm assuming there's some sort of weird command line thing I need to do, but I'm pretty clueless...any ideas?
After a tremendous amount of searching with no answer, I was able to access my local dev server by substituting the domain with the ip address. For example, instead of:
http://compass/messages
use this (with your server's IP address)
http://172.33.22.1/messages
It works in the Android emulator browser, and also from a WebView in the app in the emulator. I don't know why this works, but it does for me. Hope it helps someone else.
I was having the same problem and I wasn't been able to find any solution anywhere. What I finally did (after playing around with port forwarding) was to use ssh to create a tunnel to the remote machine:
ssh -L 5555:localhost:5555 10.0.1.14
This should allow you to connect to the local machine's IP address in the emulator (10.0.2.2) and reach the other machine in your network (on the specified port).
If anyone has a better solution for accessing the local network from the android emulator I'd love to hear it.
Intranet site may require proxy.
You can set the proxy in Settings
I have solved this problem by following steps:
adb shell
set setprop net.dns 10.10.20.19(your pc's ip)
restart your emulator.

Categories

Resources