Android OkHttpClient始终调用onFailure方法

时间:2018-05-19 22:22:05

标签: android

HttpUrl.Builder httpBuider =              HttpUrl.parse("some url here").newBuilder();
        httpBuider.addQueryParameter("email", email);
        httpBuider.addQueryParameter("password", password);    
OkHttpClient httpClient = new OkHttpClient();
        Request request = new Request.Builder().
                url(httpBuider.build()).build();

        httpClient.newCall(request).enqueue(new Callback() { ... public void onFailure() {...} ...}

所以这是我在android项目中使用的代码。始终调用onFailure方法,并且不从模拟器访问url。我把应用程序放在一个真实的设备上它似乎工作,但从模拟器它没有,我有互联网连接。我在这做错了什么?

0 个答案:

没有答案