我试图让使用从我的网站数据Retrofit
。 它的正常工作在Android 5.0,但较小的Android版本出现错误消息Connection closed by peer
。 这里是我的代码...
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://myWebsite.com/api/")
.addConverterFactory(GsonConverterFactory.create())
.build();
service = retrofit.create(MyService.class);
这里是MyService
类
@GET
Call<CategoryResponse> getCategoryResponse(@Url String url);
我缺少的是在这里吗? 它是完全工作正常了的是Android 5.0。 我认为这是值得处理SSL握手和OkHttpClient
。 我不知道如何实现OkHttpClient
与Retrofit
。
这里是我的logcat
06-29 10:50:49.906 10438-10438/com.dualbrotech.playwithprizes E/dalvikvm: Could not find class 'android.support.v4.widget.DrawerLayout$1', referenced from method android.support.v4.widget.DrawerLayout.<init>
06-29 10:50:49.914 10438-10438/com.dualbrotech.playwithprizes E/dalvikvm: Could not find class 'android.view.WindowInsets', referenced from method android.support.v4.widget.DrawerLayout.onDraw
06-29 10:50:49.917 10438-10438/com.dualbrotech.playwithprizes E/dalvikvm: Could not find class 'android.view.WindowInsets', referenced from method android.support.v4.widget.DrawerLayout.onMeasure
06-29 10:50:49.918 10438-10438/com.dualbrotech.playwithprizes E/dalvikvm: Could not find class 'android.view.WindowInsets', referenced from method android.support.v4.widget.DrawerLayout.onMeasure
06-29 10:50:51.219 10438-10611/com.dualbrotech.playwithprizes E/NativeCrypto: Unknown error during handshake
06-29 10:50:52.194 10438-10615/com.dualbrotech.playwithprizes E/NativeCrypto: ssl=0x541654b8 cert_verify_callback x509_store_ctx=0x540adab8 arg=0x0
ssl=0x541654b8 cert_verify_callback calling verifyCertificateChain authMethod=ECDHE_RSA
06-29 10:50:52.254 10438-10618/com.dualbrotech.playwithprizes E/NativeCrypto: Unknown error during handshake
06-29 10:50:52.296 10438-10438/com.dualbrotech.playwithprizes E/error: javax.net.ssl.SSLException: Connection closed by peer
06-29 10:51:31.769 10438-10618/com.dualbrotech.playwithprizes E/NativeCrypto: Unknown error during handshake
06-29 10:51:35.491 10438-10618/com.dualbrotech.playwithprizes E/NativeCrypto: Unknown error during handshake
06-29 10:51:35.503 10438-10438/com.dualbrotech.playwithprizes E/error: javax.net.ssl.SSLException: Connection closed by peer