Hi i am developing and android application which communicates with the backed server. I Tested my application inside my Working environment its working fine... I am able to connect to the server and i got the response...
But when i went for testing in my clients environment, i was unable to connect to the back end server.. I used their LAN to access web server...
The problem i am having is Unknown Host name..
Insted of giving the host name i gave the ip address to the host and my application got the response successfully from the server, but if i change the ip address to the DNS i was unable to connect..
I Tried several options
Tried to set the host ip address in Eclipse -> Window -> Preference -> Android -> Launch. but it didnt work.
I Tried to launch the emulator from the command line using the following command
emulator -avd MYAVD -dns-server X.X.X.X
this one also didn't work.
Since my time is limited to deploy i need help.
Related
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 can't open the application I'm developing in Android Studio emulator, It is showing the following message in the log
Could not open Selected VM debug port (8700). Make sure you do not have another instance of DDMS or of the eclipse plugin running. If it's being used by something else, choose a new port number in the preferences.
Unable to open connection to: localhost/17.253.38.253:5037, due to: java.net.ConnectException: Operation timed out
Following is the port listening by adb
adb 14528 unnikrishnan.b 10u IPv4 0x7e537943f4599ac9 0t0 TCP localhost:5037 (LISTEN)
This happened after I upgraded to android studio 3.1.2. How I can fix this issue?
Thanks,
Unnikrishnan B.
can be caused by an ip address in the file etc / host, sometimes you enter an additional to make tests and it is not deleted, you must check that in your file this
127.0.0.1 localhost
255.255.255.255 broadcasthost
:: 1 localhost
you can also ping the address 127.0.0.1 to check for an answer, $ ping localhost
additional information that can helps you
https://issuetracker.google.com/issues/37126279
New to Android, I have .Net webservices residing in my PC. when my Android application calls the webservice from emulator with IP address, it runs perfectly.
But running the same code in mobile does not work (mobile is connected to PC using USB cable). It shows server timeout error. Both phone and PC are on the same network.
I am unable to run - adb pull /data/anr/traces.txt. It says unrecognized command. I had Android studio installed but unable to find adb file.
So installed Android Sdk again: C:\Program Files\android-sdk-windows\tools - it says that adb file has moved to platform-tools. I tried various ways but no luck.
Any suggestions are welcome. Many thanks in advance.
If your web service is not hosted, you need to use localhost or 127.0.0.1 in your mobile app's URL IP address. Make sure they are in the same network
here is any configuration for this tools eclipse or wamp or android sdk to connect my mobile phone to wampserver?
i look this exemple in this site blow i just copy and paste the code in eclipse but the problem is how i can import and export data from my phone to database and Conversely ?
http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/
If I've understood correctly, you're running a wamp server locally on your computer and you'd like to access that server from your application. The general approach is similar to connecting to any other server, but you'd have to find the right IP-address to connect to. Try this:
First, make sure your server is up and running.
Second, access the server on your computer using one of two addresses:
If you're testing your app on the emulator (AVD), use this: 10.0.2.2, which translates to the localhost-address on your computer.
If you're testing your app on an actual device, you'd have to find your computer's IP-address. On linux, open a terminal and execute the command ifconfig. In windows, I believe it's ipconfig. Use the address listed under wlan0 -> inet addr.
Remember to append the port number your server is running on.
EDIT
Example, given port number is 80:
Emulator: 10.0.2.2:80
Device: 192.168.X.X:80
I tried all the possible options given on net and on this site, but none of them worked.
I am getting:
Launch error: Failed to connect to remote VM. Connection timed out.
when I am trying to debug my application on my mobile device.
the application runs properly with out any issue when I am running normally
I have used at lease these links by now:
How to resolve "Waiting for Debugger" message?
Eclipse issue - Launch error: Failed to connect to remote VM. Connection timed out
Eclipse Error: "Failed to connect to remote VM"
Launch error: Failed to connect to remote VM
https://forums.oracle.com/forums/thread.jspa?threadID=653343
None of the above seem to work.
Go to Window -> Preferences -> General -> Network Connections, and check if there is any proxy set here, change the 'Active Provider' to be 'Direct' and try again.
I dont know why, but this works for me:
First Run(or Debug) your application in an emulator and then Debug the application on the device (without closing the emulator).
let me know if this works for you.
I've been having the same frustrating problem. I finally found something that is working for me: making sure localhosts is being resolved correctly (and really explicitly).
Test to see if it works when your development machine is not connected to the net (no WiFi, no network cables). If it does work under those conditions, then it may be that you need to make sure that addresses are resolving to localhost properly. The messages that DDMS and adb.exe use for debugging and communicating to the VM must properly resolve to localhost on your machine. (Yes, it's odd that other commands using DDMS & adb work just fine but debugging doesn't. Seems that something in DDMS or adb needs to be standardized so they all work under the same conditions.)
If you need to make sure that things are resolving to localhost properly:
1) Make sure that this line is in your /Windows/System32/drivers/etc/hosts [windows] (or etc/hosts [*nix] file:
127.0.0.1 localhost
(you can have any amount of whitespace between "127.0.0.1" and "localhost")
2) If that doesn't work, then you may need to also add your PC's IPv4 address to the hosts file, and resolve it to localhost. (You can find out the IPv4 address for your machine with the ipconfig command.) If, for example, your machine's IPv4 address is 192.168.1.100 then you'd add the line
192.168.1.100 localhost
to your hosts file. (You can add it below the "127.0.0.1 localhost" line in the file.)
I had (1) in my hosts file but it still wasn't working (unless my PC wasn't connected to the net). I tried (2) on a bit of a guess, and that worked for me.
BTW: You can verify that adb (and your emulator if you're running one) is listening on ports by using the netstat -b command. (Note that on Win7 you need admin privileges for the -b option. I open a command window using "Run as Administrator.")
May seem like an obvious answer but make sure you don't have two emulators running - 5554; 5556; ... The debugger has difficulty setting the port when it doesn't know which one to connect to.