gpt4 book ai didi

java - Android System.err : javax.net.ssl.SSLHandshakeException:握手失败

转载 作者:行者123 更新时间:2023-12-04 22:41:28 25 4
gpt4 key购买 nike

有人可以告诉我如何解决SSLHandshakeException在安卓?
请参阅下面我尝试使用 HttpURLConnection 访问的这个 URL 时不断收到的错误。目的。

W/bile.allfundin: Accessing hidden field Ljava/net/Socket;->impl:Ljava/net/SocketImpl; (light greylist, reflection)
W/bile.allfundin: Accessing hidden method Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard; (light greylist, linking)
W/bile.allfundin: Accessing hidden method Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (light greylist, linking)
W/bile.allfundin: Accessing hidden field Ljava/io/FileDescriptor;->descriptor:I (light greylist, JNI)
I/DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21001
Selected remote version of com.google.android.gms.ads.dynamite, version >= 21001
D/DynamitePackage: Instantiated singleton DynamitePackage.
Instantiating com.google.android.gms.ads.ChimeraMobileAdsSettingManagerCreatorImpl
I/Ads: Updating ad debug logging enablement.
V/NativeCrypto: SSL handshake aborted: ssl=0x78ce68f9c8: Failure in SSL library, usually a protocol error
error:1000042e:SSL routines:OPENSSL_internal:TLSV1_ALERT_PROTOCOL_VERSION (third_party/openssl/boringssl/src/ssl/tls_record.cc:592 0x78ce688688:0x00000001)
W/bile.allfundin: Accessing hidden method Ldalvik/system/BlockGuard;->getThreadPolicy()Ldalvik/system/BlockGuard$Policy; (light greylist, linking)
W/bile.allfundin: Accessing hidden method Ldalvik/system/BlockGuard$Policy;->onNetwork()V (light greylist, linking)
Accessing hidden method Ldalvik/system/CloseGuard;->close()V (light greylist, linking)
I/WebViewFactory: Loading com.android.chrome version 79.0.3945.93 (code 394509337)
I/WebViewFactory: SystemProperties GMSVERSION = 9_201910
Get WebViewChromiumFactoryProviderForO
I/cr_LibraryLoader: Time to load native libraries: 5 ms
V/NativeCrypto: SSL handshake aborted: ssl=0x78ce68f9c8: Failure in SSL library, usually a protocol error
error:1000042e:SSL routines:OPENSSL_internal:TLSV1_ALERT_PROTOCOL_VERSION (third_party/openssl/boringssl/src/ssl/tls_record.cc:592 0x78ce688688:0x00000001)
W/System.err: javax.net.ssl.SSLHandshakeException: Handshake failed
W/System.err: at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(:com.google.android.gms@19831029@19.8.31 (100406-284611645):38)
at com.android.okhttp.internal.io.RealConnection.connectTls(RealConnection.java:192)
at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:149)
at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:112)
at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184)
at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126)
W/System.err: at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:461)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:407)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:244)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:26)
at com.techlinemobile.allfunding.utilities.NetworkUtils.getResponseFromHttpUrl(NetworkUtils.java:55)
at com.techlinemobile.allfunding.MainActivity$scholarshipQueryTask.doInBackground(MainActivity.java:92)
W/System.err: at com.techlinemobile.allfunding.MainActivity$scholarshipQueryTask.doInBackground(MainActivity.java:84)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
W/System.err: Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x78ce68f9c8: Failure in SSL library, usually a protocol error
error:1000042e:SSL routines:OPENSSL_internal:TLSV1_ALERT_PROTOCOL_VERSION (third_party/openssl/boringssl/src/ssl/tls_record.cc:592 0x78ce688688:0x00000001)
at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
at com.google.android.gms.org.conscrypt.NativeSsl.doHandshake(:com.google.android.gms@19831029@19.8.31 (100406-284611645):6)
at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(:com.google.android.gms@19831029@19.8.31 (100406-284611645):14)
... 22 more
I/chromium: [INFO:library_loader_hooks.cc(51)] Chromium logging enabled: level = 0, default verbosity = 0
I/cr_LibraryLoader: Expected native library version number "79.0.3945.93", actual native library version number "79.0.3945.93"
W/cr_ChildProcLH: Create a new ChildConnectionAllocator with package name = com.android.chrome, sandboxed = true

请参阅下面我的方法的代码
 public static String getResponseFromHttpUrl(URL url) throws IOException {
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try {
InputStream in = urlConnection.getInputStream();
Scanner scanner = new Scanner(in);
scanner.useDelimiter("\\A");

boolean hasInput = scanner.hasNext();
if (hasInput) {
return scanner.next();
} else {
return null;
}
} finally {
urlConnection.disconnect();
}
}

最佳答案

我不能为 this article 做任何功劳但这将向您展示需要安装哪些软件包来修复 TLS/SSLv3 问题。
您可能需要做的另一件事是添加

<application
android:usesCleartextTraffic="true"
...
>
到您的 AndroidManifest.xml,这是我在单元测试期间需要做的事情。

关于java - Android System.err : javax.net.ssl.SSLHandshakeException:握手失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59634704/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com