I get:
D/CrashlyticsCore: Attempting to send 4 report(s)
E/CrashlyticsCore: Error occurred sending report com.crashlytics.android.core.SessionReport#e6586d3
io.fabric.sdk.android.services.network.HttpRequest$HttpRequestException: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
at io.fabric.sdk.android.services.network.HttpRequest.part(HttpRequest.java:2546)
at io.fabric.sdk.android.services.network.HttpRequest.part(HttpRequest.java:2526)
at io.fabric.sdk.android.services.network.HttpRequest.part(HttpRequest.java:2512)
at com.crashlytics.android.core.DefaultCreateReportSpiCall.applyMultipartDataTo(DefaultCreateReportSpiCall.java:89)
at com.crashlytics.android.core.DefaultCreateReportSpiCall.invoke(DefaultCreateReportSpiCall.java:61)
at com.crashlytics.android.core.CompositeCreateReportSpiCall.invoke(CompositeCreateReportSpiCall.java:18)
at com.crashlytics.android.core.ReportUploader.forceUpload(ReportUploader.java:104)
at com.crashlytics.android.core.ReportUploader$Worker.attemptUploadWithRetry(ReportUploader.java:242)
at com.crashlytics.android.core.ReportUploader$Worker.onRun(ReportUploader.java:185)
at io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:30)
at java.lang.Thread.run(Thread.java:818)
Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:328)
at com.android.okhttp.internal.http.SocketConnector.connectTls(SocketConnector.java:103)
at com.android.okhttp.Connection.connect(Connection.java:143)
at com.android.okhttp.Connection.connectAndSetOwner(Connection.java:185)
at com.android.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:128)
at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:341)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:437)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:114)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:245)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:25)
at io.fabric.sdk.android.services.network.HttpRequest.openOutput(HttpRequest.java:2450)
at io.fabric.sdk.android.services.network.HttpRequest.startPart(HttpRequest.java:2463)
at io.fabric.sdk.android.services.network.HttpRequest.part(HttpRequest.java:2542)
at io.fabric.sdk.android.services.network.HttpRequest.part(HttpRequest.java:2526)
at io.fabric.sdk.android.services.network.HttpRequest.part(HttpRequest.java:2512)
at com.crashlytics.android.core.DefaultCreateReportSpiCall.applyMultipartDataTo(DefaultCreateReportSpiCall.java:89)
at com.crashlytics.android.core.DefaultCreateReportSpiCall.invoke(DefaultCreateReportSpiCall.java:61)
at com.crashlytics.android.core.CompositeCreateReportSpiCall.invoke(CompositeCreateReportSpiCall.java:18)
at com.crashlytics.android.core.ReportUploader.forceUpload(ReportUploader.java:104)
at com.crashlytics.android.core.ReportUploader$Worker.attemptUploadWithRetry(ReportUploader.java:242)
at com.crashlytics.android.core.ReportUploader$Worker.onRun(ReportUploader.java:185)
at io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:30)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:329)
at com.android.org.conscrypt.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:230)
at com.android.org.conscrypt.Platform.checkServerTrusted(Platform.java:115)
at com.android.org.conscrypt.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:556)
at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:324)
at com.android.okhttp.internal.http.SocketConnector.connectTls(SocketConnector.java:103)
at com.android.okhttp.Connection.connect(Connection.java:143)
at com.android.okhttp.Connection.connectAndSetOwner(Connection.java:185)
at com.android.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:128)
at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:341)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:437)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:114)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:245)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:25)
at io.fabric.sdk.android.services.network.HttpRequest.openOutput(HttpRequest.java:2450)
at io.fabric.sdk.android.services.network.HttpRequest.startPart(HttpRequest.java:2463)
at io.fabric.sdk.android.services.network.HttpRequest.part(HttpRequest.java:2542)
at io.fabric.sdk.android.services.network.HttpRequest.part(HttpRequest.java:2526)
at io.fabric.sdk.android.services.network.HttpRequest.part(HttpRequest.java:2512)
at com.crashlytics.android.core.DefaultCreateReportSpiCall.applyMultipartDataTo(DefaultCreateReportSpiCall.java:89)
at com.crashlytics.android.core.DefaultCreateReportSpiCall.invoke(DefaultCreateReportSpiCall.java:61)
at com.crashlytics.android.core.CompositeCreateReportSpiCall.invoke(CompositeCreateReportSpiCall.java:18)
at com.crashlytics.android.core.ReportUploader.forceUpload(ReportUploader.java:104)
at com.crashlytics.android.core.ReportUploader$Worker.attemptUploadWithRetry(ReportUploader.java:242)
at com.crashlytics.android.core.ReportUploader$Worker.onRun(ReportUploader.java:185)
at io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:30)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:329)
at com.android.org.conscrypt.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:230)
at com.android.org.conscrypt.Platform.checkServerTrusted(Platform.java:115)
at com.android.org.conscrypt.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:556)
at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:324)
at com.android.okhttp.internal.http.SocketConnector.connectTls(SocketConnector.java:103)
at com.android.okhttp.Connection.connect(Connection.java:143)
at com.android.okhttp.Connection.connectAndSetOwner(Connection.java:185)
at com.android.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:128)
at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:341)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:437)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:114)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:245)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:25)
at io.fabric.sdk.android.services.network.HttpRequest.openOutput(HttpRequest.java:2450)
at io.fabric.sdk.android.services.network.HttpRequest.startPart(HttpRequest.java:2463)
at io.fabric.sdk.android.services.network.HttpRequest.part(HttpRequest.java:2542)
at io.fabric.sdk.android.services.network.HttpRequest.part(HttpRequest.java:2526)
at io.fabric.sdk.android.services.network.HttpRequest.part(HttpRequest.java:2512)
at com.crashlytics.android.core.DefaultCreateReportSpiCall.applyMultipartDataTo(DefaultCreateReportSpiCall.java:89)
at com.crashlytics.android.core.DefaultCreateReportSpiCall.invoke(DefaultCreateReportSpiCall.java:61)
at com.crashlytics.android.core.CompositeCreateReportSpiCall.invoke(CompositeCreateReportSpiCall.java:18)
at com.crashlytics.android.core.ReportUploader.forceUpload(ReportUploader.java:104)
at com.crashlytics.android.core.ReportUploader$Worker.attemptUploadWithRetry(ReportUploader.java:242)
at com.crashlytics.android.core.ReportUploader$Worker.onRun(ReportUploader.java:185)
at io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:30)
at java.lang.Thread.run(Thread.java:818)
Any help??
Related
I'm trying to send a simple HTTP request to a ESP8266 from my Android phone. I'm following this tutorial. The code works for the URL used in the tutorial (https://reqres.in/api/users?page=2), however not for the URL that turns on the LED on ESP8266. (Turning on the LED is possible through a browser though, so it must be something with the code). The URL is https://192.168.137.78/led/1.
The stacktrace is quite long, but this is the first error,
2020-06-13 12:55:55.948 13594-13631/com.example.esp W/System.err: java.net.ConnectException: Failed to connect to /192.168.137.78:443
The rest of the stacktrace:
2020-06-13 12:55:55.948 13594-13631/com.example.esp W/System.err: java.net.ConnectException: Failed to connect to /192.168.137.78:443
2020-06-13 12:55:55.949 13594-13631/com.example.esp W/System.err: at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:285)
2020-06-13 12:55:55.949 13594-13631/com.example.esp W/System.err: at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:195)
2020-06-13 12:55:55.950 13594-13631/com.example.esp W/System.err: at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:249)
2020-06-13 12:55:55.950 13594-13631/com.example.esp W/System.err: at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:108)
2020-06-13 12:55:55.950 13594-13631/com.example.esp W/System.err: at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:76)
2020-06-13 12:55:55.951 13594-13631/com.example.esp W/System.err: at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:245)
2020-06-13 12:55:55.951 13594-13631/com.example.esp W/System.err: at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
2020-06-13 12:55:55.951 13594-13631/com.example.esp W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
2020-06-13 12:55:55.951 13594-13631/com.example.esp W/System.err: at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:96)
2020-06-13 12:55:55.952 13594-13631/com.example.esp W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
2020-06-13 12:55:55.952 13594-13631/com.example.esp W/System.err: at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
2020-06-13 12:55:55.952 13594-13631/com.example.esp W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
2020-06-13 12:55:55.953 13594-13631/com.example.esp W/System.err: at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
2020-06-13 12:55:55.953 13594-13631/com.example.esp W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
2020-06-13 12:55:55.953 13594-13631/com.example.esp W/System.err: at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:197)
2020-06-13 12:55:55.954 13594-13631/com.example.esp W/System.err: at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:502)
2020-06-13 12:55:55.954 13594-13631/com.example.esp W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2020-06-13 12:55:55.954 13594-13631/com.example.esp W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2020-06-13 12:55:55.955 13594-13631/com.example.esp W/System.err: at java.lang.Thread.run(Thread.java:919)
2020-06-13 12:55:55.956 13594-13631/com.example.esp W/System.err: Caused by: java.net.ConnectException: failed to connect to /192.168.137.78 (port 443) from /192.168.137.82 (port 42408) after 10000ms: isConnected failed: ECONNREFUSED (Connection refused)
2020-06-13 12:55:55.956 13594-13631/com.example.esp W/System.err: at libcore.io.IoBridge.isConnected(IoBridge.java:288)
2020-06-13 12:55:55.957 13594-13631/com.example.esp W/System.err: at libcore.io.IoBridge.connectErrno(IoBridge.java:193)
2020-06-13 12:55:55.957 13594-13631/com.example.esp W/System.err: at libcore.io.IoBridge.connect(IoBridge.java:135)
2020-06-13 12:55:55.957 13594-13631/com.example.esp W/System.err: at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:142)
2020-06-13 12:55:55.957 13594-13631/com.example.esp W/System.err: at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:390)
2020-06-13 12:55:55.958 13594-13631/com.example.esp W/System.err: at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:230)
2020-06-13 12:55:55.958 13594-13631/com.example.esp W/System.err: at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:212)
2020-06-13 12:55:55.959 13594-13631/com.example.esp W/System.err: at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436)
2020-06-13 12:55:55.959 13594-13631/com.example.esp W/System.err: at java.net.Socket.connect(Socket.java:621)
2020-06-13 12:55:55.959 13594-13631/com.example.esp W/System.err: at okhttp3.internal.platform.Platform.connectSocket(Platform.kt:120)
2020-06-13 12:55:55.960 13594-13631/com.example.esp W/System.err: at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:283)
2020-06-13 12:55:55.960 13594-13631/com.example.esp W/System.err: ... 18 more
2020-06-13 12:55:55.961 13594-13631/com.example.esp W/System.err: Caused by: android.system.ErrnoException: isConnected failed: ECONNREFUSED (Connection refused)
2020-06-13 12:55:55.961 13594-13631/com.example.esp W/System.err: at libcore.io.IoBridge.isConnected(IoBridge.java:275)
2020-06-13 12:55:55.961 13594-13631/com.example.esp W/System.err: ... 28 more
You're sending an HTTPS request, not an HTTP request. You haven't shared the code you're running on the ESP8266 but I'll bet that it's an HTTP server not an HTTPS server. Change the URL that you're trying to connect with to http:// instead of https://.
My android app has the error like following.
W/System.err: java.net.UnknownHostException: Unable to resolve host "setting.adzcore.com": No address associated with hostname
W/System.err: at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:156)
at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103)
at java.net.InetAddress.getAllByName(InetAddress.java:1152)
at com.android.okhttp.Dns$1.lookup(Dns.java:41)
at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:178)
at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:144)
W/System.err: at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:86)
at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:176)
at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128)
at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:411)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:542)
at it.partytrack.sdk.compress.f.a(Unknown Source:167)
at it.partytrack.sdk.compress.f.a(Unknown Source:14)
at it.partytrack.sdk.compress.k.run(Unknown Source:93)
Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
at libcore.io.Linux.android_getaddrinfo(Native Method)
at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:74)
at libcore.io.BlockGuardOs.android_getaddrinfo(BlockGuardOs.java:200)
at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:74)
at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:135)
... 17 more
Replace setting.adzcore.com with https://setting.adzcore.com
I am trying to use a government api (https://api.usno.navy.mil/rstt/oneday?date=8/8/2019&coords=48.39,-115.56&tz=-7) to get sunrise and sunset type information and I get the error java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. I was having the same problems using the Chrome browser on Windows 10 until I imported the government certificates.
However, I can not figure out how to get the Android Studio emulator to recognize the certs (I will worry about my Nexus 6 device after I get everything working in the emulator).
I have a file of the government certs and have added them to Android Studio using Settings/tools/ServerCertificates. The certs I have added are DOD ID SW CA-38, DoD Root CA 2, DoD Root CA 3, and DoD Root CA 4. When I look at the certificate path on the browser, it shows DoD Root CA 3, DOD ID SW CA-38 and api.usno.navy.mil. The api.usno.navy.mil cert was issued by DOD ID SW CA-38.
I have tried setting the Server Certificates to "Accept non-trusted certificates automatically" (not my favorite option).
All were no help. I have also looked through the stackoverflow messages that seem related and did not find a solution. I am trying to not use third party apps.
Although it was not apparently needed in the browser, could there be some other certificate specifically for the api.usno.navy.mil reference?
The usno (U.S. Naval Observatory) has requested certificates that are more generally acknowledged (versus the DoD certificates), but they don't know when the administrators will provide them.
How can I get the Android Studio emulator to recognize these DoD certificates?
Any suggestions would be appreciated. Thanks.
Complete stack trace follows:
4424-4451/com.drme.weathertest W/System.err: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
4424-4451/com.drme.weathertest W/System.err: at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(:com.google.android.gms#13280022#13.2.80 (040700-211705629):47)
4424-4451/com.drme.weathertest W/System.err: at com.android.okhttp.internal.io.RealConnection.connectTls(RealConnection.java:192)
4424-4451/com.drme.weathertest W/System.err: at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:149)
4424-4451/com.drme.weathertest W/System.err: at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:112)
4424-4451/com.drme.weathertest W/System.err: at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184)
4424-4451/com.drme.weathertest W/System.err: at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126)
4424-4451/com.drme.weathertest W/System.err: at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95)
4424-4451/com.drme.weathertest W/System.err: at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281)
4424-4451/com.drme.weathertest W/System.err: at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224)
4424-4451/com.drme.weathertest W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:461)
4424-4451/com.drme.weathertest W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:407)
4424-4451/com.drme.weathertest W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:244)
4424-4451/com.drme.weathertest W/System.err: at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
4424-4451/com.drme.weathertest W/System.err: at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(Unknown Source:0)
4424-4451/com.drme.weathertest W/System.err: at com.drme.weatherNoaa.NetworkHelpers.getUrlBytes(NetworkHelpers.java:123)
4424-4451/com.drme.weathertest W/System.err: at com.drme.weatherNoaa.SunMoonWebRunnable.run(SunMoonWebRunnable.java:108)
4424-4451/com.drme.weathertest W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
4424-4451/com.drme.weathertest W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
4424-4451/com.drme.weathertest W/System.err: at java.lang.Thread.run(Thread.java:764)
4424-4451/com.drme.weathertest W/System.err: Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
4424-4451/com.drme.weathertest W/System.err: at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:646)
4424-4451/com.drme.weathertest W/System.err: at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:495)
4424-4451/com.drme.weathertest W/System.err: at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:418)
4424-4451/com.drme.weathertest W/System.err: at com.android.org.conscrypt.TrustManagerImpl.getTrustedChainForServer(TrustManagerImpl.java:339)
4424-4451/com.drme.weathertest W/System.err: at android.security.net.config.NetworkSecurityTrustManager.checkServerTrusted(NetworkSecurityTrustManager.java:94)
4424-4451/com.drme.weathertest W/System.err: at android.security.net.config.RootTrustManager.checkServerTrusted(RootTrustManager.java:88)
4424-4451/com.drme.weathertest W/System.err: at java.lang.reflect.Method.invoke(Native Method)
4424-4451/com.drme.weathertest W/System.err: at com.google.android.gms.org.conscrypt.Platform.checkTrusted(:com.google.android.gms#13280022#13.2.80 (040700-211705629):2)
4424-4451/com.drme.weathertest W/System.err: at com.google.android.gms.org.conscrypt.Platform.checkServerTrusted(:com.google.android.gms#13280022#13.2.80 (040700-211705629):1)
4424-4451/com.drme.weathertest W/System.err: at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.verifyCertificateChain(:com.google.android.gms#13280022#13.2.80 (040700-211705629):5)
4424-4451/com.drme.weathertest W/System.err: at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
4424-4451/com.drme.weathertest W/System.err: at com.google.android.gms.org.conscrypt.NativeSsl.doHandshake(:com.google.android.gms#13280022#13.2.80 (040700-211705629):8)
4424-4451/com.drme.weathertest W/System.err: at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(:com.google.android.gms#13280022#13.2.80 (040700-211705629):15)
4424-4451/com.drme.weathertest W/System.err: ... 18 more
I just use SSL connections in my android project and it works fine but sometimes I get this error:
HTTP FAILED: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:361)
at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:299)
at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:268)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:160)
at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:256)
at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:134)
at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:113)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:211)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:147)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:549)
at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:401)
at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:375)
at com.android.org.conscrypt.TrustManagerImpl.getTrustedChainForServer(TrustManagerImpl.java:304)
at android.security.net.config.NetworkSecurityTrustManager.checkServerTrusted(NetworkSecurityTrustManager.java:94)
at android.security.net.config.RootTrustManager.checkServerTrusted(RootTrustManager.java:88)
at com.android.org.conscrypt.Platform.checkServerTrusted(Platform.java:178)
at com.android.org.conscrypt.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:596)
at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:357)
... 26 more
Caused by: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
... 36 more
as you can see it says that it cannot found my certificate but it happens sometimes not all the time.
my certificate is not a self-certificate type.
can anyone help me with that
I'm having trouble connecting Android studio emulator to Internet behind proxy.
I have enabled permission in android Manifest.xml
<uses-permission android:name="android.permission.INTERNET" />
And the app works perfectly well in USB Debug mode.
This is the error i get when i run the app on Emulator.
Following is my Logcat .
D/makeGitHubSearchQuery: Inside Function
D/makeGitHubSearchQuery: HTTP
D/makeGitHubSearchQuery: https://api.github.com/search/repositories?q=HTTP&sort=stars
D/OnOptionsItemSelected: action_search
W/System.err: java.net.UnknownHostException: Unable to resolve host "api.github.com": No address associated with hostname
W/System.err: at java.net.InetAddress.lookupHostByName(InetAddress.java:470)
W/System.err: at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
W/System.err: at java.net.InetAddress.getAllByName(InetAddress.java:215)
W/System.err: at com.android.okhttp.internal.Network$1.resolveInetAddresses(Network.java:29)
W/System.err: at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:188)
W/System.err: at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:157)
W/System.err: at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:100)
W/System.err: at com.android.okhttp.internal.http.HttpEngine.createNextConnection(HttpEngine.java:357)
W/System.err: at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:340)
W/System.err: at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330)
W/System.err: at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248)
W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:433)
W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:384)
W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:231)
W/System.err: at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
W/System.err: at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java)
W/System.err: at com.example.android.datafrominternet.utilities.NetworkUtils.getResponseFromHttpUrl(NetworkUtils.java:76)
W/System.err: at com.example.android.datafrominternet.MainActivity$GithubQueryTask.doInBackground(MainActivity.java:77)
W/System.err: at com.example.android.datafrominternet.MainActivity$GithubQueryTask.doInBackground(MainActivity.java:71)
W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:295)
W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
W/System.err: at java.lang.Thread.run(Thread.java:818)
W/System.err: Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
W/System.err: at libcore.io.Posix.android_getaddrinfo(Native Method)
W/System.err: at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:55)
W/System.err: at java.net.InetAddress.lookupHostByName(InetAddress.java:451)
Please guide me in setting the Proxy settings in Android emulator.
Use this command to open emulator with the desired proxy.
emulator -avd [emulator_name] -http-proxy [proxy ip address]:[port]
official docs