I have a native android app for https connection demo, I got exception like this::
我有一个用于https连接演示的原生Android应用程序,我有这样的异常::
my connection code is simple:
我的连接代码很简单:
URL url = new URL("https://192.168.1.5:7443/worklightconsole");
HttpsURLConnection urlConnection =
(HttpsURLConnection)url.openConnection();
HostnameVerifier sss=urlConnection.getHostnameVerifier();
// urlConnection.setHostnameVerifier(hostnameVerifier);
InputStream in = urlConnection.getInputStream();
So I assumed that android-21 api used okhttp for default connection, however, if I typed com.squareup.okhttp in android studio it does not show up the auto-complete for classes in the okhttp package, which disable me to debug the hostname verifier sss, noted that i debug the programme I can see the sss is actually a "OKHostnameVerifier" type, I need to debug some of the methods in this class hence I really want to know how to debug Okhttp.
所以我假设android-21 api使用okhttp进行默认连接,但是,如果我在android studio中输入com.squareup.okhttp它没有显示okhttp包中的类的自动完成,这使我无法调试主机名验证程序sss,注意我调试程序我可以看到sss实际上是一个“OKHostnameVerifier”类型,我需要调试这个类中的一些方法因此我真的想知道如何调试Okhttp。
In other classes I can press CMD+Click to enter that class and set break point
在其他课程中,我可以按CMD +单击进入该课程并设置断点
1 个解决方案
#1
0
Just add this to your Gradle file under compile:
只需将其添加到编译下的Gradle文件中:
compile 'com.squareup.okhttp:okhttp:2.2.0'
#1
0
Just add this to your Gradle file under compile:
只需将其添加到编译下的Gradle文件中:
compile 'com.squareup.okhttp:okhttp:2.2.0'