When I try to access a URL with getting method getting,
D/OkHttp: <-- HTTP FAILED: java.net.UnknownHostException: Unable to resolve host "xyz.aaa.net": No address associated with hostname
But I am getting success response in POST MAN. Its been two days but not getting any clue.Changed the Actual URL to xyz.aaa.net due to autorization issue.Sorry for that :
Call<Response> call2 = apiInterface.getEmployeeListNew("1190",1008,"true"
);
call2.enqueue(new Callback<Response>() {
@Override
public void onResponse(Call<TaxProResponse> call, Response<Response> response) { }
@Override
public void onFailure(Call<TaxProResponse> call, Throwable t) {
call.cancel();
}
});
API Client :
class APIClient {
private static Retrofit retrofit = null;
static Retrofit getClient() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
retrofit = new Retrofit.Builder()
.baseUrl("http://xyz.aaa.net/api/")
.addConverterFactory(GsonConverterFactory.create())
.client(client)
.build();
return retrofit;
}
}
APIInterface :
@GET("Profile")
Call<Response> getEmployeeListNew(
@Header("app_id") String app_id,
@Query("office_id") int office_id,
@Query("need_only_active") String need_only_active
);
whole URL need to be like this with app_id as Header :
http://xyz.aaa.net/api/Profile?office_id=1008&need_only_active=true
If Any of you has faced this issue before please give some suggetion. Tried with some other request,It working fine.Provide the permission,
<uses-permission android:name="android.permission.INTERNET"/>
Its not issue of permission like other questions in Stackoverflow.Tried with there solutions and its not working.
As Asked here is Full Log
06-25 12:11:38.143 8450-8450/? I/zygote64: Late-enabling -Xcheck:jni
06-25 12:11:38.436 8450-8450/com.journaldev.retrofitintro D/NetworkSecurityConfig: No Network Security Config specified, using platform default
06-25 12:11:38.495 8450-8469/com.journaldev.retrofitintro D/OkHttp: --> GET http://xyz.aaa.net/api/AMTPProfile?office_id=1008&need_only_active=true http/1.1
app_id: 1190
06-25 12:11:38.497 8450-8469/com.journaldev.retrofitintro D/OkHttp: --> END GET
06-25 12:11:38.516 8450-8471/com.journaldev.retrofitintro D/OpenGLRenderer: HWUI GL Pipeline
06-25 12:11:38.561 8450-8471/com.journaldev.retrofitintro I/Adreno: QUALCOMM build : 8e59954, I0be83d0d26
Build Date : 09/22/17
OpenGL ES Shader Compiler Version: EV031.21.02.00
Local Branch : O17A
Remote Branch :
Remote Branch :
Reconstruct Branch :
06-25 12:11:38.564 8450-8471/com.journaldev.retrofitintro D/vndksupport: Loading /vendor/lib64/hw/gralloc.msm8994.so from current namespace instead of sphal namespace.
06-25 12:11:38.581 8450-8471/com.journaldev.retrofitintro I/Adreno: PFP: 0x00000000, ME: 0x00000000
06-25 12:11:38.598 8450-8471/com.journaldev.retrofitintro I/zygote64: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
06-25 12:11:38.602 8450-8471/com.journaldev.retrofitintro I/OpenGLRenderer: Initialized EGL, version 1.4
06-25 12:11:38.603 8450-8471/com.journaldev.retrofitintro D/OpenGLRenderer: Swap behavior 2
06-25 12:11:38.622 8450-8471/com.journaldev.retrofitintro D/vndksupport: Loading /vendor/lib64/hw/android.hardware.graphics.mapper@2.0-impl.so from current namespace instead of sphal namespace.
Loading /vendor/lib64/hw/gralloc.msm8994.so from current namespace instead of sphal namespace.
06-25 12:11:41.808 8450-8469/com.journaldev.retrofitintro D/OkHttp: <-- HTTP FAILED: java.net.UnknownHostException: Unable to resolve host "xyz.aaa.net": No address associated with hostname
Thanks in Advance.
User contributions licensed under CC BY-SA 3.0