emulator throwing hostunresolved exception in android? - android

i have as my first activity in my application a request to a certain address, from where i get XML and then i parse it...
I have added the permission on for internet access in my android.manifest file.
my problem
whenever i run my application on my emulator the following exception is thrown:
05-19 18:25:05.099: WARN/System.err(473): java.net.UnknownHostException: Host is unresolved: www.svgverlag.de:80
i don't understand what is going wrong.
when i open the same address in my browser it opens up fine
i have tried restarting the emulator several times.
i am using a mac.
thank you in advance.
EDIT:
i have tried creating several emulators and in all of them this is happening.Also i tried on my friends macbook pro, and the same thing is happening.
Also in the emulator's browser no webpage is opening.For some reason the emulator is not able to access the internet.
UPDATE
I believe that there is a problem with the emulator on mac per se. No matter what i try:
set the dns in Eclipse Preferences using dns-server- 8.8.8.8
turn of my firewall
nothing seems to make a difference and my emulator is not able to access the internet.
Also there is a 3G symbol at the top of my emulator but with no help regarding internet access.
While on a my windows machine, things seem to work fine without any settings from my side.
what do i do?

Can you try using the IP address of this website instead of using its host name?

Related

I can not access my notebook with my Android using IPv4

I'm having a bad problem and it already gave me a headache. I did an application with Magic Software and to run it on my Android I have to configure Magic Studio the right way (done), run the project on the Magic server (done and working) and install MagicDev.apk on android (available in the Magic XPA folder and already done), and when finished installing, the application must be run and when it is executed it asks to enter the URL of the Magic application, which is the following: http://[IPv4_of_notebook]/MagicScripts/DevProps.txt, but when you try to access this, it is not possible, it says that the application was not found or the connection failed.
It is worth mentioning, I had this same access problem when using XAMPP or Wamp, because when trying to access the localhost with the cell phone, the link would not respond, it would load until I gave the message (I put Wamp online for this, of course, and changed the settings in the [files].conf). Another important thing is that I made an Android application in Android Studio where one of its functions was to access the internet and although the application installed on Android really could not connect to the link, the emulator accessed quietly (the emulator runs inside the pc, would there be anything?) and I could do what I had to do, this link was on a page I made using Wamp, that is, the emulator accessed my IP, and the cell phone can not.
My question: Is this some configuration of the notebook, Android, Internet router or am I doing something wrong? My friend created a page using Wamp, configured it correctly and placed it online and from my home, with his IP, I accessed the page (with my notebook) in a quiet way. One more note, my notebook connects to the internet with Wifi and my Android too, meaning they are not connected to the source directly as my room PC is, and I do not know if that also matters.
I will later try to run the application on my PC from the room and see if it gives him access to his IPv4, but I do not think it will work either. Anyway, does anyone have any idea what it can be? I do not like messing with my notebook's Internet and other settings without knowing what I'm actually doing, I'm afraid to make my notebook vulnerable. Here in this video https://www.youtube.com/watch?v=1njzFq07t2U you can see the process I'm describing here, but it's not working for me.
I already figured out the villain, it was the firewall. When I turned it off everything worked as expected. I can not keep it turned off for security reasons, but from what I've seen I can configure it to accept only my phone.

Visual Studio 2015 CTP5 Android Emulator loopback to localhost?

I am using VS 2013 to connect with the new VS2015 Android Emulator. This seems to work now and I can debug, set breakpoints etc which is all fine. (Now, I would use VS2015 but it won't deploy properly -never mind).
I am also developing the server app on my machine and using Fiddler as an http debug aid.. not an uncommon situation I am sure.
The server is running (also under debug in another instance of VS 2013) using IIS Express and I have added bindings to the applicationhost.config so the IISExpress server is visible on my LAN from other PC's and I've checked it is visible.
Try as I might I can not seem to get the Emulator to send the http requests back to my computer.
My javascript uses a servicebase to hold the url:
var serviceBase = 'http://192.168.2.4:64963/'; //'http://169.254.220.177:64963/'; //'http://10.0.2.2:64963/'; //'http://localhost:64963/';
The commented ones show the ones I have tried. None of these works.. the first is the IP of my machine on the LAN, the rest are various ones I have picked up here or the Android dev site.. I have also tried:
http://mymachinename:64963
Because I am bringing both web AND API services from this URL I have also tried a chrome browser on my real android phone (over wifi on my LAN) and this can't get to my dev machine either (where my other pc's can). So I get that it probably can't resolve the names? But really not sure where to go next? I wondered about the Hosts file on my PC but not sure if I can/should set an IP address as a host name? .. any pointers? Thanks, Brett
169.254.80.80 is the localhost loopback.
By going to Additional Tools in the VS emulator for Android (click the >> button on the right hand side) and selecting the Network tab, you will get all the information about the network connectivity.
For the localhost loopback, use the address listed under the Desktop Adapter #2. Desktop Adapter #1 should work as well, which is the IP address of your machine.
I am answering this because I have seen a lot of comments/questions about this topic and need to include some bits that it is hard to fit in the comments.. and I have solved it.
First the solution.. was to delete/replace the vsemu.vhd and vsemu.sdcard.vhd for the emulator with safe copies. This was because in my efforts to fix the problem I assume I had changed some setting in the emulator phone data. Sadly I am not sure what.
However, and this checklist may be useful to someone, before this I was led to it by the fact that because I had web services as well as API from my server URL I was able to test webpage access. This worked on pcs but failed on wifi connected android devices on my network with pc names.. as mentioned in my original question. But it wouldn't work with a numeric IP address either.
I had already added the numeric IP to the applicationhosts.config file of IISExpress, but what I hadn't done, because I thought its on the machine its referring to, was execute the
netsh http add urlacl url=http://192.168.2.1:94693/ user=everyone
command to let it all through.
Once I had done this, I was able to connect using the IP address from a phone, and this led me to discover that the Emulator had obviously got some form of problem. Replacing the VHD's fixed this and I am now communicating.
In case anyone else has this issue using the following IP's worked for me:
IP of the machine
169.254.80.80
However, do remember that VS Android emulator is running in a Hyper-v VM,
So I had to punch a hole in my firewall to allow for my application port to be reached by the emulator.
If your using Web API with visual studio 2015 and VS Android emulator this link helped me out a lot
Use 10.0.2.2, This is the loopback from emulator to your host machine.
See link:
http://developer.android.com/tools/devices/emulator.html
I was having the same issue, but none of the above answers were useful for me.
My BackEnd is a PHP SlimFramework Rest Api.
I decided to change the IP in the auto start of the Slim (was localhost:7888), I tried this: php -S 192.168.43.20:7888, and everything was working fine after I configure the calls to that ip.
I hope this may help someone...
In generic the IP you must consider is the IP of the network you are using/allocated to run the android emulator.
Very raw/rude method of finding it is by going to settings (gear symbol on right panel of emulator, not the one inside) and look for ip address. . Or by opening the ADB Logging window and it's on the top left corner.
Now in command prompt type ipconfig and match the first 3 numbers of IP and that's the network your localhost loopback.
Because in many cases we will have more than one ethernets or virtualbox host only networks are running.
Happy Coding!!

Network Connectivity Error In Android Emulator

I know that there are several threads posted about this issue, however I believe my problem to be a bit different:
I have installed Android emulator on my desktop.
When i try to browse internet via the emulator, it works perfect.
But the problem is the apps that i have installed in the emulator are not able to access the internet
i installed whatsapp successfully, the registration screen loads properly, then i entered my mobile number and pressed OK button. I keep getting the following error
Unable to connect. Please check that you are connected to the internet
and try again. Please reboot your phone if your connection problem
persists.
Its very annoying that i have been Googleing the error for weeks now and still havent reached a solution to the problem
I tried bluestacks .. i also reinstalled it as well as emulator several times... it did not help...
1000 thanks to person that helps me solve this issue..:D
Re install emulator
Delete and create the emulator again
Check whether machine is connected to online
Check Android manifest to see whether application has access to internet
These are some common issues.
From this answer:
<manifest xlmns:android...>
...
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>
inside your AndroidManifest.xml
Add 8.8.8.8
on a Mac: System Preferences > Network > DNS
(or equivalent for Windows)
As described here: Android emulator not able to access the internet
I have installed youwave on my laptop at home and downloaded whatsapp, then registered in whatsapp. It worked perfectly without any problem.
Then I tried the same at office and it did not work. But can access the internet thru the browser. I believe that the reason is that at office I'm behind a proxy and not sure if whatsapp uses certain protocols not allowed by office proxy.
ok... i have the same problem.
but i know, what is the best solution till now for bluestacks connection problem.
you have to install proxycap software.
make new proxy rules for bluestacks.
in c/program*86/bluestacks/HD-network.exe
this is the file that you have to make rule for.
whatsapp will work and other apps too.
but still u can't download data using bluestacks.
but yes if you have bluetooth then there is no problem. connect ur phone having internet connection.
and your rule's proxy will allow you to download data. the good thing is that 95% data is downloaded through your wired network(LAN). bluetooth connection of phone just helps you to maintain the server side connected...and now go to google store or wtever u want to download. you are good to go.
and just activate a small data pack on your phone.... thanxx.. hope that would help
one solution can be to disable the gps, just go to advance conf. then to location and turn that off. that worked for me at least.

Android UnresolvedHostException on real device using servername

Hi I am developing an application which is connected to a cooperate network via a VPN-connection.
Now I have the following problem:
If I try to send a HTTP-Request from a real device to a server located in the network using the server-name the logcat shows an UnresolvedHostException.
If I am using the IP of the server instead everything works fine as expected.
On the emulator the problem does not appear at all and everything works.
So I tested this on the browser of my device and the browser seems to have the same problem, using the IP, the browser can access the server, but if I use the server-name the browser returns a 404 error.
Does anyone have a clue why this problem is appearing or can give me a hint how to solve this issue, I have searched the web but cannot find a proper solution anywhere.
If anyone is having the same problem, shutdown your device wait a moment so it totally powers of and then restart it, this solves the problem and saves you a lot of time, stress and rage, it seems like their is a bug in the system (at least on some API versions)

Android 2.1 Emulator Without Internet Connection

I have no Internet access in my Android Emulator.
The app I am developing needs Internet connection, but the Android Emulator have no internet connection. I also tried to use the native browser of the emulator, but it also does not work.
When I export my app to a real android, it works just fine.
I already tried to press F8 to turn on and off the "3G connection" in the emulator.
I already turned off the Windows Firewall, but it didn't work.
Data:
Windows 7 x64
Eclipse Plugin for Android
Android version 2.1
Try recreating the emulator instance. Sometimes the instances get corrupted and you get weird behavior like the one described by you above. The internet connection should work without any interaction in a fresh emulator instance.
If you are behind a firewall or you are using a proxy then things can get a bit more complicated but there are workarounds for those situations also.
Don't keep re-creating new instances of the same emulator. I had this problem before and created a brand new emulator (same settings as the other one), and it worked fine for some reason.
I had to set manually the DNS Server of my emulator.
To do that:
Within Eclipse I went to Run Configurations -> Target and added "-dns-server X.X.X.X" and everything worked fine afterwards. (obviously X.X.X.X was the IP address for my DNS server).
so i put this line: -debug-slirp -dns-server 192.168.178.1

Categories

Resources