I am developing an Android app, using Mobile ADF in JDeveloper 11.
I used weblogic server with SOAP service. When I test the webservice, its working fine, but I am getting this error after deployment on Android emulator -
"cannot connect to 127.0.0.1 on port 7101: java.net.ConnectionException:connection refused".
use 10.0.2.2 instead of 127.0.0.1
and for SOAP
use port 8080 instead of 7701
Use 10.0.2.2 instead of 127.0.0.1
10.0.2.2 Special alias to your host loopback interface (i.e., 127.0.0.1 on your development machine)
Reference: Emulator Networking
Use this address: 10.0.2.2 or the real IP address if you have one.
See also the Docs
Related
I try to use SSH on Android the first time, i had read a lot about it but i cant find much, only from Android to Computer. Maybe someone can help me here:)
I have coded an APK for my own Android Device wheres create an SSH Connection over my PHP Script using Proxy Server.
I use an Debian VPS as Proxy Server. With this IP, the Android creates an Proxy.
Now i use this Comment:
ssh -N -L 34836:127.0.0.1:34836 newgenerateduser#23.106.XXX.XX
Port is generated also random every time i create an new proxy over PHP Script.
I use now an Virtual Machine with Ubuntu and enter the Comment in my Terminal with the Passwort after asking.
I start my VNC Client and want get remote Control over my Android device using VNC or SSH with this IP and Port:
127.0.0.1:34836
I got this Message:
lxs#linux-virtual-machine:~$ ssh -N -L 34836:127.0.0.1:34836 newgenerateduser#23.106.XXX.XX
newgenerateduser#23.106.XXX.XX's password:
channel 2: open failed: connect failed: Connection refused
I also tried using localhost instead of IP.
There are special requirements for the Proxy Server? Or just Port blocking on it?
Thanks for your help!
I try to get into the localhost server from android simulator and I can not. What should I do to get in?
Use the IP address 10.0.2.2 instead of localhost
Further Read This
https://developer.android.com/studio/run/emulator-networking.html
I'm attempting to test my local dockerised API against a staging version of my app.
I don't have access to the repository to build the App myself so I'm relying on changing the IP address within the emulator to point at my local machine and that's where I'm failing.
I've set it to 10.0.2.2 as per the emulator documentation, and when I ping the staging url from the ADB shell (ping mystagingsite.com) it responds data from 10.0.2.2 . But from within the app, the response is always empty. I've tried 127.0.0.1 which obviously won't work, and I've tried my network IP address.
Is what I'm trying to do possible? If it is, what is the right IP address to put in the /etc/hosts file of the emulator and how do I find that address?
I'm using laravel valet to serve an API on a Mac. How can you access it from an Android emulator
As the Android Emulator is different computer than your Mac, you should use the IP address of the Mac (or its name if it is resolved on your network) instead of localhost.
For example if your Mac has IP address 192.168.1.10, then use this address.
Edit the /etc/hosts file on your Android Emulator following the instructions in this SO answer.
Add the following to this file:
myapp.test 10.0.2.2
This will route requests made to myapp.test to 10.0.2.2, which is a static IP address that an AVD uses instead of localhost to access the host.
I'm running a local http server on port 3000 and i'd like to access that server using an Android emulator. I've tried the following in the browser:
localhost:3000 //
127.0.0.1:3000 // of course I gave my local ip a try
10.0.3.2:3000 // I think this is a genymotion ip?
10.0.2.2:3000 // The most prevailing suggestion was to use this ip
With each of these i'm given this error:
Interestingly when accessing the same in chrome on my desktop:
localhost:3000 // works
127.0.0.1:3000 // doesn't work
Perhaps this is connected? I'm not sure why 127.0.0.1:3000 doesn't work, but that might be a different hurdle altogether.
My /etc/hosts file:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
I've already tried reloading (& disabling) my firewall and proxies.
The emulator i'm using is:
Mac, Android Studio 1.5.1
Emulator : Nexus 5 - API 21, Android 5.0 x86
Use following Service
https://ngrok.com/
It will give you a tunnel to localhost and give you a URL which you can use from anywhere in the world ;)