2, on the simulator browser visit 10.0.2.2 can see get_data. The XML document.
But reference book, how also couldn't access the Web server, depressed, the great god grant instruction, many thanks!
Private void sendRequestWithOKHttp () {
New Thread (new Runnable () {
@ Override
Public void the run () {
Try {
OkHttpClient client=new OkHttpClient ();
Request the Request=new Request. Builder ()
Url (" https://10.0.2.2/get_data.xml ")
The build ();
The Response the Response=client. NewCall (request). The execute ();
String responseData=(https://bbs.csdn.net/topics/response.body). The String ();
ShowResponse (responseData);
//parseXMLWithPull (responseData);
} the catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
CodePudding user response:
I also saw this, meet the same problem, the computer can access, mobile phone connection failure of lifeCodePudding user response:
I also met