首页 新闻 会员 周边

Source Not Found. 很纠结的一个问题。

0
悬赏园豆:10 [已解决问题] 解决于 2013-03-08 14:11

一段很简单的代码:

 1 String url = "http://10.122.10.197/r28crm/login.aspx?uid=yepl&pwd=1&t=t";
 2 try
 3 {
 4     DefaultHttpClient client = new DefaultHttpClient();
 5     HttpGet request = new HttpGet(url);
 6     HttpResponse response = client.execute(request);//每次调试到这一句就会出现Source Not Found.
 7     StatusLine status = response.getStatusLine();
 8     int statusCode = status.getStatusCode();
 9     switch(statusCode) {
10     case 200:
11         break;
12     }
13 }catch(ClientProtocolException ex) {
14                 
15 }catch(IOException ex){
16                 
17 }

我在AndroidManifest.xml有配置 

<uses-permission android:name="android.permission.INTERNET"/>

我找了好多资料都没能解决这个问题。求各位大侠指点。。另附上问题图片:

大家能指点下么?我这个是在模拟器里面用浏览器是能访问那个Url的。

俗人...的主页 俗人... | 初学一级 | 园豆:83
提问于:2013-03-05 11:08
< >
分享
最佳答案
0

终于可以了。。。
在Android 4.0以上,访问网络不能在主程序中进行。。

http://stackoverflow.com/questions/6343166/android-os-networkonmainthreadexception
http://geeksun.iteye.com/blog/1447708

俗人... | 初学一级 |园豆:83 | 2013-03-08 14:09
其他回答(1)
0

hi men,it seems to not found zhe androvid.jar at zhe folder of D:\Program Files (x86)\adt-bondle-windows-x86_64\sdk\platforms\

收获园豆:10
zhibudao | 园豆:525 (小虾三级) | 2013-03-05 15:33

Not because of this. the file is there.

支持(0) 反对(0) 俗人... | 园豆:83 (初学一级) | 2013-03-05 15:50

@慢了节奏...: 有配置 这个jar的地方吗?或这个jar有问题

支持(0) 反对(0) zhibudao | 园豆:525 (小虾三级) | 2013-03-06 10:02
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册