Could not validate certificate: null - android

I'm trying to connect to a webserver using an Android 4.4.2 based device, when connecting with newer devices everything works fine but when connecting with these older devices I get the following error:
javax.net.ssl.SSLHandshakeException: com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate: null
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:409)
at com.android.okhttp.Connection.upgradeToTls(Connection.java:146)
at com.android.okhttp.Connection.connect(Connection.java:107)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294)
at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:179)
at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:246)
at com.mypackage.myapp.api.myappApi.getOptions(myappApi.java:117)
at com.mypackage.myapp.service.myappCommService.getOptions(myappCommService.java:104)
at com.mypackage.myapp.service.myappCommService.onHandleIntent(myappCommService.java:120)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.os.HandlerThread.run(HandlerThread.java:61)
Caused by: java.security.cert.CertificateException: com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate: null
at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:308)
at com.android.org.conscrypt.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:202)
at com.android.org.conscrypt.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:611)
at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405)
at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) 
at com.android.okhttp.Connection.connect(Connection.java:107) 
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) 
at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) 
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) 
at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) 
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296) 
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:179) 
at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:246) 
at com.mypackage.myapp.api.myappApi.getOptions(myappApi.java:117) 
at com.mypackage.myapp.service.myappCommService.getOptions(myappCommService.java:104) 
at com.mypackage.myapp.service.myappCommService.onHandleIntent(myappCommService.java:120) 
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) 
at android.os.Handler.dispatchMessage(Handler.java:110) 
at android.os.Looper.loop(Looper.java:193) 
at android.os.HandlerThread.run(HandlerThread.java:61) 
Caused by: com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate: null
at com.android.org.bouncycastle.jce.provider.RFC3280CertPathUtilities.processCertA(RFC3280CertPathUtilities.java:1488)
at com.android.org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi.engineValidate(PKIXCertPathValidatorSpi.java:305)
at java.security.cert.CertPathValidator.validate(CertPathValidator.java:190)
at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:295)
at com.android.org.conscrypt.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:202) 
at com.android.org.conscrypt.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:611) 
at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) 
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) 
at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) 
at com.android.okhttp.Connection.connect(Connection.java:107) 
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) 
at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) 
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) 
at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) 
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296) 
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:179) 
at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:246) 
at com.mypackage.myapp.api.myappApi.getOptions(myappApi.java:117) 
at com.mypackage.myapp.service.myappCommService.getOptions(myappCommService.java:104) 
at com.mypackage.myapp.service.myappCommService.onHandleIntent(myappCommService.java:120) 
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) 
at android.os.Handler.dispatchMessage(Handler.java:110) 
at android.os.Looper.loop(Looper.java:193) 
at android.os.HandlerThread.run(HandlerThread.java:61) 
Caused by: java.security.cert.CertificateExpiredException
at com.android.org.conscrypt.OpenSSLX509Certificate.checkValidity(OpenSSLX509Certificate.java:220)
at com.android.org.bouncycastle.jce.provider.RFC3280CertPathUtilities.processCertA(RFC3280CertPathUtilities.java:1483)
at com.android.org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi.engineValidate(PKIXCertPathValidatorSpi.java:305) 
at java.security.cert.CertPathValidator.validate(CertPathValidator.java:190) 
at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:295) 
at com.android.org.conscrypt.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:202) 
at com.android.org.conscrypt.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:611) 
at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) 
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) 
at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) 
at com.android.okhttp.Connection.connect(Connection.java:107) 
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) 
at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) 
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) 
at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) 
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296) 
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:179) 
at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:246) 
at com.mypackage.myapp.api.myappApi.getOptions(myappApi.java:117) 
at com.mypackage.myapp.service.myappCommService.getOptions(myappCommService.java:104) 
at com.mypackage.myapp.service.myappCommService.onHandleIntent(myappCommService.java:120) 
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) 
at android.os.Handler.dispatchMessage(Handler.java:110) 
at android.os.Looper.loop(Looper.java:193) 
at android.os.HandlerThread.run(HandlerThread.java:61) 
06-29 10:14:40.270 2498-4412/com.mypackage.myapp E/NativeCrypto: ssl=0x54e32608 cert_verify_callback x509_store_ctx=0x55e20938 arg=0x0
06-29 10:14:40.270 2498-4412/com.mypackage.myapp E/NativeCrypto: ssl=0x54e32608 cert_verify_callback calling verifyCertificateChain authMethod=ECDHE_RSA
I have implemented a custom SSLSocketFactory to try and force it to connect by using TLSV1.2 as that seemed to be a common error but that didn't change anything in the error that was thrown. The date and time on this device are set to the current date and time. It's not just happening on this device but on all devices that use an Android version pre 4.4.2.

Make sure the "Date and Time" of your device is up-to-date

An even older device with Android 4.0 threw a clearer error, the root certificate of the server I was trying to connect to had expired and was thus causing issues.

Related

How to extend VpnService to open an L2TP/IPSEC connection in android programmatically?

I am looking to implement a solution to open a L2TP/IPSEC connection from the android application so I can simply pass the server ip, pre-shared key, username and password and so the device is connected to this VPN server
I looked here https://developer.android.com/reference/android/net/VpnService.html that we need to extend and build our own VPN solutions to do that.
Is there any available solutions for that so we can use it instead of reinventing the wheel?
I tried the below implementations of VpnService but none of them worked for me
https://android.googlesource.com/platform/development/+/master/samples/ToyVpn/src/com/example/android/toyvpn
https://pomgit.com/limeysoft/L2TP-VPN/tree/master/app
And tried this
https://alvinalexander.com/java/jwarehouse/android/vpn/java/android/net/vpn/
and got the below error
mtpd: Start VPN daemon: mtpd W/libc: Set property "ctl.start" to
"mtpd"
Unable to set property "ctl.start" to "mtpd": connection failed; errno=13 (Permission denied) E/SysPropJNI:
SystemProperties_set key:ctl.start,val:mtpd W/System.err:
java.io.IOException: cannot start service: mtpd W/System.err: at
com.mega.speed.vpn.DaemonProxy.start(DaemonProxy.java:58)
W/System.err: at
com.mega.speed.vpn.VpnDaemons.startDaemon(VpnDaemons.java:92)
at com.mega.speed.vpn.VpnDaemons.startMtpd(VpnDaemons.java:113)
at com.mega.speed.vpn.VpnDaemons.startL2tp(VpnDaemons.java:36)
W/System.err: at
com.mega.speed.vpn.L2tpService.connect(L2tpService.java:16)
at com.mega.speed.fragments.HotspotFragment.onCreateView(HotspotFragment.java:125)
W/System.err: at
android.support.v4.app.Fragment.performCreateView(Fragment.java:2439)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)
W/System.err: at
android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)
W/System.err: at
android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:802)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)
W/System.err: at
android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
W/System.err: at
android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:733)
at android.os.Handler.handleCallback(Handler.java:808) W/System.err:
at android.os.Handler.dispatchMessage(Handler.java:101)
at android.os.Looper.loop(Looper.java:166) W/System.err: at
android.app.ActivityThread.main(ActivityThread.java:7529)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
W/System.err: at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)

Android Studio 3.0.0-beta1 -- NoClassDefFoundError

Since upgrading Android Studio to v3.0.0-beta1 and amending classpath to 'com.android.tools.build:gradle:3.0.0-beta1' I am being hit with the following error each time my rxjava/retrofit code throws an error (a 401 HttpException in this example).
java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.
at rx.android.schedulers.LooperScheduler$ScheduledAction.run(LooperScheduler.java:114)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by: rx.exceptions.OnErrorFailedException: Error occurred when trying to propagate error to Observer.onError
at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:187)
at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:115)
at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.checkTerminated(OperatorObserveOn.java:273)
at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.call(OperatorObserveOn.java:216)
at rx.android.schedulers.LooperScheduler$ScheduledAction.run(LooperScheduler.java:107)
at android.os.Handler.handleCallback(Handler.java:746) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5443) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
Caused by: rx.exceptions.CompositeException: 2 exceptions occurred.
at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:187) 
at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:115) 
at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.checkTerminated(OperatorObserveOn.java:273) 
at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.call(OperatorObserveOn.java:216) 
at rx.android.schedulers.LooperScheduler$ScheduledAction.run(LooperScheduler.java:107) 
at android.os.Handler.handleCallback(Handler.java:746) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5443) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
Caused by: rx.exceptions.CompositeException$CompositeExceptionCausalChain: Chain of Causes for CompositeException In Order Received =>
at android.util.Log.getStackTraceString(Log.java:522)
at com.android.internal.os.RuntimeInit.Clog_e(RuntimeInit.java:61)
at com.android.internal.os.RuntimeInit.-wrap0(RuntimeInit.java)
at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:86)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
at rx.android.schedulers.LooperScheduler$ScheduledAction.run(LooperScheduler.java:118)
at android.os.Handler.handleCallback(Handler.java:746) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5443) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
Caused by: retrofit2.adapter.rxjava.HttpException: HTTP 401 Unauthorized
at retrofit2.adapter.rxjava.OperatorMapResponseToBodyOrError$1.onNext(OperatorMapResponseToBodyOrError.java:43)
at retrofit2.adapter.rxjava.OperatorMapResponseToBodyOrError$1.onNext(OperatorMapResponseToBodyOrError.java:38)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$RequestArbiter.request(RxJavaCallAdapterFactory.java:173)
at rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber$1.request(OperatorSubscribeOn.java:109)
at rx.Subscriber.setProducer(Subscriber.java:211)
at rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber.setProducer(OperatorSubscribeOn.java:105)
at rx.Subscriber.setProducer(Subscriber.java:205)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:152)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:138)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe(Observable.java:10346)
at rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber.call(OperatorSubscribeOn.java:100)
at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call(CachedThreadScheduler.java:230)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension;
All error handlers have been set appropriately for RxJava calls.
Android sdk build tools v26.0.1
Tried clean, rebuild etc
Tried disabling Instant-Run
This issue was addressed by Google and fixed in Beta 2 update.
Friday, August 11, 2017
Android Studio 3.0 Beta 2 is now available in
the Canary and Dev channels. This release fixes an issue which
resulted in the compiler throwing a ClassNotFoundException when you
enable Java 8 language features and specify minSdkVersion 19 or
higher—this also caused some code analysis tools, such as ProGuard, to
fail. For more information, see issue #64527520.

LocalFingerprints: cannot compute fingerprint

I am getting one strange error it occurs randomly to any time and crashes the app. i am testing on nexus 6 in Android 7.0
here is log cat
E/LocalFingerprints: cannot compute fingerprint for: content://media/external/images/media/306155
java.io.IOException: read failed: EISDIR (Is a directory)
at libcore.io.IoBridge.read(IoBridge.java:481)
at java.io.FileInputStream.read(FileInputStream.java:252)
at android.os.ParcelFileDescriptor$AutoCloseInputStream.read(ParcelFileDescriptor.java:889)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:273)
at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
at java.security.DigestInputStream.read(DigestInputStream.java:161)
at java.io.FilterInputStream.read(FilterInputStream.java:107)
at kei.b(PG:81)
at imp.a(PG:1324)
at ilf.a(PG:131)
at com.google.android.libraries.social.autobackup.FingerprintScannerIntentService.onHandleIntent(PG:81)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:67)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.os.HandlerThread.run(HandlerThread.java:61)
Caused by: android.system.ErrnoException: read failed: EISDIR (Is a directory)
at libcore.io.Posix.readBytes(Native Method)
at libcore.io.Posix.read(Posix.java:169)
at libcore.io.BlockGuardOs.read(BlockGuardOs.java:231)
at libcore.io.IoBridge.read(IoBridge.java:471)
at java.io.FileInputStream.read(FileInputStream.java:252) 
at android.os.ParcelFileDescriptor$AutoCloseInputStream.read(ParcelFileDescriptor.java:889) 
at java.io.BufferedInputStream.read1(BufferedInputStream.java:273) 
at java.io.BufferedInputStream.read(BufferedInputStream.java:334) 
at java.security.DigestInputStream.read(DigestInputStream.java:161) 
at java.io.FilterInputStream.read(FilterInputStream.java:107) 
at kei.b(PG:81) 
at imp.a(PG:1324) 
at ilf.a(PG:131) 
at com.google.android.libraries.social.autobackup.FingerprintScannerIntentService.onHandleIntent(PG:81) 
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:67) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.os.HandlerThread.run(HandlerThread.java:61) 

Not able to receive crash reports in Acralyzer from ACRA

Below I have given all the crash logs printed in Logcat. I am crashing the app with the below code on a button's onclicklistener. The server is running and the device and server are in same wifi network.
throw new RuntimeException("This is a crash");
I went throught the installation twice for Acralyzer and couldn't find my mistake. And I am hosting the server my own laptop.
If anyone need any more details I am willing to post it. All the server related details I used as a guide is here
There is no reports displayed in server as well.
Logcat Logs
E/ACRA: ACRA caught a RuntimeException for com.example.sys.myapplication
java.lang.RuntimeException: This is a crash
at com.example.sys.myapplication.MainActivity$3.onClick(MainActivity.java:111)
at android.view.View.performClick(View.java:5207)
at android.view.View$PerformClick.run(View.java:21168)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.sys.myapplication, PID: 16543
java.lang.RuntimeException: This is a crash
at com.example.sys.myapplication.MainActivity$3.onClick(MainActivity.java:111)
at android.view.View.performClick(View.java:5207)
at android.view.View$PerformClick.run(View.java:21168)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
W/System: ClassLoader referenced unknown path: /data/app/com.example.sys.myapplication-2/lib/arm
W/System: ClassLoader referenced unknown path: /data/app/com.example.sys.myapplication-2/lib/arm
E/InstantRun: IO Error creating local socket at com.example.sys.myapplication
java.io.IOException: Address already in use
at android.net.LocalSocketImpl.bindLocal(Native Method)
at android.net.LocalSocketImpl.bind(LocalSocketImpl.java:309)
at android.net.LocalServerSocket.<init>(LocalServerSocket.java:48)
at com.android.tools.fd.runtime.Server.<init>(Server.java:94)
at com.android.tools.fd.runtime.Server.create(Server.java:88)
at com.android.tools.fd.runtime.BootstrapApplication.onCreate(BootstrapApplication.java:315)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1036)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4728)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
I/ACRA: Sending report /data/user/0/com.example.sys.myapplication/app_ACRA-approved/2016-05-05T18:44:37.046+05:30.stacktrace
E/ACRA: Failed to send crash report for /data/user/0/com.example.sys.myapplication/app_ACRA-approved/2016-05-05T18:44:37.046+05:30.stacktrace
org.acra.sender.ReportSenderException: Error while sending JSON report via Http POST
at org.acra.sender.HttpSender.send(HttpSender.java:236)
at org.acra.sender.ReportDistributor.sendCrashReport(ReportDistributor.java:102)
at org.acra.sender.ReportDistributor.distribute(ReportDistributor.java:70)
at org.acra.sender.SenderService.onHandleIntent(SenderService.java:69)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
Caused by: java.net.SocketTimeoutException: failed to connect to /192.168.1.15 (port 5984) after 5000ms
at libcore.io.IoBridge.connectErrno(IoBridge.java:169)
at libcore.io.IoBridge.connect(IoBridge.java:122)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:183)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:452)
at java.net.Socket.connect(Socket.java:884)
at com.android.okhttp.internal.Platform.connectSocket(Platform.java:117)
at com.android.okhttp.internal.http.SocketConnector.connectRawSocket(SocketConnector.java:160)
at com.android.okhttp.internal.http.SocketConnector.connectCleartext(SocketConnector.java:67)
at com.android.okhttp.Connection.connect(Connection.java:152)
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 org.acra.util.HttpRequest.send(HttpRequest.java:142)
at org.acra.sender.HttpSender.send(HttpSender.java:233)
at org.acra.sender.ReportDistributor.sendCrashReport(ReportDistributor.java:102) 
at org.acra.sender.ReportDistributor.distribute(ReportDistributor.java:70) 
at org.acra.sender.SenderService.onHandleIntent(SenderService.java:69) 
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.os.HandlerThread.run(HandlerThread.java:61) 
I/ACRA: Sending report /data/user/0/com.example.sys.myapplication/app_ACRA-approved/2016-05-05T19:02:07.897+05:30.stacktrace
E/ACRA: Failed to send crash report for /data/user/0/com.example.sys.myapplication/app_ACRA-approved/2016-05-05T19:02:07.897+05:30.stacktrace
org.acra.sender.ReportSenderException: Error while sending JSON report via Http POST
at org.acra.sender.HttpSender.send(HttpSender.java:236)
at org.acra.sender.ReportDistributor.sendCrashReport(ReportDistributor.java:102)
at org.acra.sender.ReportDistributor.distribute(ReportDistributor.java:70)
at org.acra.sender.SenderService.onHandleIntent(SenderService.java:69)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
Caused by: java.net.SocketTimeoutException: failed to connect to /192.168.1.15 (port 5984) after 5000ms
at libcore.io.IoBridge.connectErrno(IoBridge.java:169)
at libcore.io.IoBridge.connect(IoBridge.java:122)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:183)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:452)
at java.net.Socket.connect(Socket.java:884)
at com.android.okhttp.internal.Platform.connectSocket(Platform.java:117)
at com.android.okhttp.internal.http.SocketConnector.connectRawSocket(SocketConnector.java:160)
at com.android.okhttp.internal.http.SocketConnector.connectCleartext(SocketConnector.java:67)
at com.android.okhttp.Connection.connect(Connection.java:152)
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 org.acra.util.HttpRequest.send(HttpRequest.java:142)
at org.acra.sender.HttpSender.send(HttpSender.java:233)
at org.acra.sender.ReportDistributor.sendCrashReport(ReportDistributor.java:102) 
at org.acra.sender.ReportDistributor.distribute(ReportDistributor.java:70) 
at org.acra.sender.SenderService.onHandleIntent(SenderService.java:69) 
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.os.HandlerThread.run(HandlerThread.java:61) 
I/ACRA: Sending report /data/user/0/com.example.sys.myapplication/app_ACRA-approved/2016-05-05T19:03:58.007+05:30.stacktrace
E/ACRA: Failed to send crash report for /data/user/0/com.example.sys.myapplication/app_ACRA-approved/2016-05-05T19:03:58.007+05:30.stacktrace
org.acra.sender.ReportSenderException: Error while sending JSON report via Http POST
at org.acra.sender.HttpSender.send(HttpSender.java:236)
at org.acra.sender.ReportDistributor.sendCrashReport(ReportDistributor.java:102)
at org.acra.sender.ReportDistributor.distribute(ReportDistributor.java:70)
at org.acra.sender.SenderService.onHandleIntent(SenderService.java:69)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
Caused by: java.net.SocketTimeoutException: failed to connect to /192.168.1.15 (port 5984) after 5000ms
at libcore.io.IoBridge.connectErrno(IoBridge.java:169)
at libcore.io.IoBridge.connect(IoBridge.java:122)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:183)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:452)
at java.net.Socket.connect(Socket.java:884)
at com.android.okhttp.internal.Platform.connectSocket(Platform.java:117)
at com.android.okhttp.internal.http.SocketConnector.connectRawSocket(SocketConnector.java:160)
at com.android.okhttp.internal.http.SocketConnector.connectCleartext(SocketConnector.java:67)
at com.android.okhttp.Connection.connect(Connection.java:152)
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 org.acra.util.HttpRequest.send(HttpRequest.java:142)
at org.acra.sender.HttpSender.send(HttpSender.java:233)
at org.acra.sender.ReportDistributor.sendCrashReport(ReportDistributor.java:102) 
at org.acra.sender.ReportDistributor.distribute(ReportDistributor.java:70) 
at org.acra.sender.SenderService.onHandleIntent(SenderService.java:69) 
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.os.HandlerThread.run(HandlerThread.java:61) 
I/ACRA: Sending report /data/user/0/com.example.sys.myapplication/app_ACRA-approved/2016-05-05T19:20:27.024+05:30.stacktrace
The log is pretty clear:
java.net.SocketTimeoutException: failed to connect to /192.168.1.15 (port 5984)
ACRA can't reach the server.
You can check if you can reach the server from a normal mobile browser to identify the problems location.
For those who might struggle with the same issue, here's what I did. Couchdb by default listens only to the localhost. You can enable listening for remote device or other systems by setting from bind_address = 127.0.0.1 to bind_address = 0.0.0.0. The files can be found under C:\Program Files (x86)\Apache Software Foundation\CouchDB\etc\couchdb, default.ini and local.ini. Check in both as for me it was default.ini and local.ini file had it commented out. local.ini file settings will override default.ini file as stated in documentation of local.ini file.
btw this didn't solve my entire problem yet. Now I am able to send the request to the server. But the Acralyzer Dashboard shows no details of the inserted data. And I am not sure yet whether the data is inserted correctly or not.

android studio cannot find twitter certificate

I get the error
com.twitter.sdk.android.core.TwitterApiException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:390)
at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at retrofit.Platform$Android$2$1.run(Platform.java:142)
at java.lang.Thread.run(Thread.java:818)
Authorization completed with an error
com.twitter.sdk.android.core.TwitterAuthException: Failed to get request token
at com.twitter.sdk.android.core.identity.OAuthController$1.failure(OAuthController.java:95)
at com.twitter.sdk.android.core.internal.oauth.OAuth1aService$1.failure(OAuth1aService.java:215)
at com.twitter.sdk.android.core.Callback.failure(Callback.java:45)
at retrofit.CallbackRunnable$2.run(CallbackRunnable.java:53)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5837)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
And Android Studio > Preferences > Server Certificates > does not have any Accepted Certificates.
How do I add the certificate?

Categories

Resources