How can i set the environment variable GOOGLE_APPLICATION_CREDENTIALS? - android

I know this type of question has been asked before and i have gone through this but still facing this issue. I was using this example . But while i run my code i got following exception
Failed to detect whether we are running on Google Compute Engine.
java.net.ConnectException: Failed to connect to /169.254.169.254:80
at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:143)
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)
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.connect(HttpURLConnectionImpl.java:127)
at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:104)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:981)
at com.google.auth.oauth2.ComputeEngineCredentials.runningOnComputeEngine(ComputeEngineCredentials.java:191)
at com.google.auth.oauth2.DefaultCredentialsProvider.tryGetComputeCredentials(DefaultCredentialsProvider.java:270)
at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentialsUnsynchronized(DefaultCredentialsProvider.java:194)
at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentials(DefaultCredentialsProvider.java:112)
at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:127)
at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:100)
at com.google.api.gax.core.GoogleCredentialsProvider.getCredentials(GoogleCredentialsProvider.java:53)
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:134)
at com.google.cloud.dialogflow.v2.stub.GrpcSessionsStub.create(GrpcSessionsStub.java:75)
at com.google.cloud.dialogflow.v2.stub.SessionsStubSettings.createStub(SessionsStubSettings.java:100)
at com.google.cloud.dialogflow.v2.SessionsClient.(SessionsClient.java:132)
at com.google.cloud.dialogflow.v2.SessionsClient.create(SessionsClient.java:114)
at com.google.cloud.dialogflow.v2.SessionsClient.create(SessionsClient.java:106)
at com.example.lpt_0096.dialogflowv2.MainActivity$MyAsync.detectIntentStream(MainActivity.java:76)
at com.example.lpt_0096.dialogflowv2.MainActivity$MyAsync.doInBackground(MainActivity.java:61)
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:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
W/System.err: java.io.IOException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
W/System.err: at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentials(DefaultCredentialsProvider.java:119)
W/System.err: at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:127)
W/System.err: at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:100)
W/System.err: at com.google.api.gax.core.GoogleCredentialsProvider.getCredentials(GoogleCredentialsProvider.java:53)
W/System.err: at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:134)
W/System.err: at com.google.cloud.dialogflow.v2.stub.GrpcSessionsStub.create(GrpcSessionsStub.java:75)
W/System.err: at com.google.cloud.dialogflow.v2.stub.SessionsStubSettings.createStub(SessionsStubSettings.java:100)
W/System.err: at com.google.cloud.dialogflow.v2.SessionsClient.(SessionsClient.java:132)
W/System.err: at com.google.cloud.dialogflow.v2.SessionsClient.create(SessionsClient.java:114)
W/System.err: at com.google.cloud.dialogflow.v2.SessionsClient.create(SessionsClient.java:106)
W/System.err: at com.example.lpt_0096.dialogflowv2.MainActivity$MyAsync.detectIntentStream(MainActivity.java:76)
W/System.err: at com.example.lpt_0096.dialogflowv2.MainActivity$MyAsync.doInBackground(MainActivity.java:61)
W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:333)
W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
W/System.err: at java.lang.Thread.run(Thread.java:764)
from where can i set environment variable in android studio, I am windows user

From the error
java.io.IOException: The Application Default Credentials are not
available. They are available if running in Google Compute Engine.
Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS
must be defined pointing to a file defining the credentials
See
https://developers.google.com/accounts/docs/application-default-credentials
for more information.
You may need to add this in the environment variable path GOOGLE_APPLICATION_CREDENTIALS=path/to/your/service_accont_key_file.json. And should get the json file from here https://cloud.google.com/docs/authentication/getting-started . Also if you don't know how to set environment variable path you can check this https://www.computerhope.com/issues/ch000549.htm

Related

Google SignIn API Exception 10 when compile on another computer

The Google SignIn inside my Android app runs perfectly well (I can sign in using any Google accounts on the phone) when I compiled the code in my daily-laptop. But when I cloned the code in my other laptop and compiled it there, it will always return Code 10 error.
Here's the full e.printStackTrace()
W/System.err: com.google.android.gms.common.api.ApiException: 10:
W/System.err: at com.google.android.gms.common.internal.ApiExceptionUtil.fromStatus(Unknown Source:4)
W/System.err: at com.google.android.gms.auth.api.signin.GoogleSignIn.getSignedInAccountFromIntent(Unknown Source:8)
W/System.err: at com.imincode.earthlings.view.ui.Register.onActivityResult(Register.kt:443)
W/System.err: at android.app.Activity.dispatchActivityResult(Activity.java:8110)
W/System.err: at android.app.ActivityThread.deliverResults(ActivityThread.java:4839)
W/System.err: at android.app.ActivityThread.handleSendResult(ActivityThread.java:4887)
W/System.err: at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
W/System.err: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
W/System.err: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2017)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:107)
W/System.err: at android.os.Looper.loop(Looper.java:214)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7403)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
In my console.developers.google.com Project Credentials, under Application restrictions I chose Android apps and I've triple confirmed that I put the correct SHA-1 signing-certificate fingerprint from both my daily computer and this other laptop.
Edit: And I can confirm that google-services.json is there under app folder on both machine.
The solution is to add the SHA Key to your project in your firebase , Go To :
Project Overview -> Click on Settings Icon -> Project Settings -> General -> Scroll down under your package name -> Add your SHA key

How to solve port 80 problem in connecting to MySQL with wamp server from android app?

Inserting data from android app to MySQL, fail to connect port 80.
I used WAMP server,android studio3.0,already setting the firewall to open the port 80,and I don't know how to edit httpd.conf file, help.
Fail massage in android studio:
E/GraphResponse: {HttpStatus: 404, errorCode: 803, subErrorCode: -1, errorType: OAuthException, errorMessage: (#803) Cannot query users by their username (CHANGE-ME)}
W/System.err: java.net.ConnectException: Failed to connect to /xxx.xxx.xx.xx:80
W/System.err: at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:143)
at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:112)
W/System.err: at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184)
W/System.err: at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126)
at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281)
W/System.err: at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:461)
W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:127)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:258)
at com.eric.timicaller31.BackgroundWorker.doInBackground(BackgroundWorker.java:48)
W/System.err: at com.eric.timicaller31.BackgroundWorker.doInBackground(BackgroundWorker.java:19)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
W/InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed.

How to get Android Studio to recognize DoD ssl certificates

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

Can not load data from webservice from the first time

After getting facebook access token, i use it for login in my own web server. However in the first time, there is warning in the log file, and i can not load data from my server, but when i open app from second times, it load normally.
Below is warning log:
W/System.err: com.google.gson.JsonSyntaxException:
java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING
at line 1 column 1 path $ W/System.err: at
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224)
W/System.err: at
retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:39)
W/System.err: at
retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:27)
W/System.err: at
retrofit2.ServiceMethod.toResponse(ServiceMethod.java:122)
W/System.err: at
retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:217) W/System.err:
at retrofit2.OkHttpCall.execute(OkHttpCall.java:180) W/System.err:
at
retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:42) W/System.err: at
io.reactivex.Observable.subscribe(Observable.java:12084) W/System.err:
at
retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:34)
W/System.err: at
io.reactivex.Observable.subscribe(Observable.java:12084) W/System.err:
at
io.reactivex.internal.operators.observable.ObservableSingleSingle.subscribeActual(ObservableSingleSingle.java:35)
W/System.err: at io.reactivex.Single.subscribe(Single.java:3433)
W/System.err: at
io.reactivex.internal.operators.single.SingleDoOnSuccess.subscribeActual(SingleDoOnSuccess.java:35)
W/System.err: at io.reactivex.Single.subscribe(Single.java:3433)
W/System.err: at
io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
W/System.err: at
io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:579)
W/System.err: at
io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
W/System.err: at
io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
W/System.err: at
java.util.concurrent.FutureTask.run(FutureTask.java:266) W/System.err:
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
W/System.err: at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/System.err: at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/System.err: at java.lang.Thread.run(Thread.java:764)
W/System.err: Caused by: java.lang.IllegalStateException: Expected
BEGIN_OBJECT but was STRING at line 1 column 1 path $ W/System.err:
at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
W/System.err: at
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213)
What could be causing this?
That error tells you that there is an error when GSON tries to parse the JSON returned by the web service you're calling. In particular, GSON is expecting a JSON object, but it receives a string (see the first line of the error message).
If the error happens only the first time you call it and not the second it means that the web service returns 2 different answers, and GSON can correctly parse the second one, but not the first one.
In order to find out what's wrong, you should provide more details, like your data model and the 2 responses returned by the web service.

Volley SSL error when uploading a file larger than 1mb (I/O error during system call, Connection reset by peer)

I tried adding a retry policy (https://stackoverflow.com/a/22169775/2098493)
but the error persist when file being uploaded is larger than 1mb.
W/System.err: com.android.volley.NoConnectionError: javax.net.ssl.SSLException: Write error: ssl=0xafc3fe00: I/O error during system call, Connection reset by peer
W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:151)
W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)
W/System.err: Caused by: javax.net.ssl.SSLException: Write error: ssl=0xafc3fe00: I/O error during system call, Connection reset by peer
W/System.err: at com.android.org.conscrypt.NativeCrypto.SSL_write(Native Method)
W/System.err: at com.android.org.conscrypt.OpenSSLSocketImpl$SSLOutputStream.write(OpenSSLSocketImpl.java:765)
W/System.err: at com.android.okio.Okio$1.write(Okio.java:70)
W/System.err: at com.android.okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.java:116)
W/System.err: at com.android.okio.RealBufferedSink.write(RealBufferedSink.java:44)
W/System.err: at com.android.okhttp.internal.http.RetryableSink.writeToSocket(RetryableSink.java:77)
W/System.err: at com.android.okhttp.internal.http.HttpConnection.writeRequestBody(HttpConnection.java:240)
W/System.err: at com.android.okhttp.internal.http.HttpTransport.writeRequestBody(HttpTransport.java:77)
W/System.err: at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:622)
W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:388)
W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:332)
W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:500)
W/System.err: at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
W/System.err: at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
W/System.err: at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:110)
W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:96)
Thanks for your advice.
The solution was a combination of adding Volley Retry Policy and making sure back-end and server (nodejs/nginx) max uploaded file size are both set correctly.
//where RETRY_DEFAULT_TIMEOUT_MS = 5000, RETRY_DEFAULT_MAX_RETRIES = 3, RETRY_DEFAULT_BACKOFF_MULT = 2.0f
request.setRetryPolicy(new DefaultRetryPolicy(RETRY_DEFAULT_TIMEOUT_MS,
RETRY_DEFAULT_MAX_RETRIES,
RETRY_DEFAULT_BACKOFF_MULT));

Categories

Resources