开发者

Socket Exception android

I'm trying to download a csv file from a website and am using the following code for that:

URL url = new URL(link);
URLConnection urlConnection = url.openConnection();
FileReader file = new FileReader((File) urlConnection.getContent());
CSVReader csvReader = new CSVReader (file);

But when I try to run this in the emulator it throws a Socket Exception. All searches I did for this exception said add the permission to use the internet in the manifest file. However even after doing that I still get the same error. I'm wondering if there is something in the emulator settings that might be needed to be changed. Because in my emulator the wifi connection is not highlighted.

App开发者_运维问答reciate any help!

here is the error log that shows me that there is Wi-Fi driver failure on the emulator 05-20 15:37:32.065: ERROR/WifiService(57): Failed to load Wi-Fi driver. 05-20 15:37:33.245: ERROR/WifiService(57): Failed to load Wi-Fi driver. 05-20 15:37:34.145: ERROR/WifiService(57): Failed to load Wi-Fi driver.


In your emulator, do you have all the correct Wifi/Internet options set? If so, check out this older posting Android: Simulate WiFi in the emulator?

Also, make sure you have the correct internet-related permissions in your Android Manifest file (and make sure they're set up properly in the XML!)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜