rafaelsf80 / cloud-pubsub-grpc-android Goto Github PK
View Code? Open in Web Editor NEWSample app to access to Cloud PubSub (gRPC) from an Android device
Sample app to access to Cloud PubSub (gRPC) from an Android device
Finally, I use protoc 3.0.0-beta-1 and upload message using pubsub. But after a certain time, it gives me following error.
D/PublishMessageTask: Exception: io.grpc.StatusRuntimeException: UNAUTHENTICATED 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: io.grpc.StatusRuntimeException: UNAUTHENTICATED 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at io.grpc.Status.asRuntimeException(Status.java:431) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:208) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:115) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.google.pubsub.v1.PublisherGrpc$PublisherBlockingStub.publish(PublisherGrpc.java:235) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.stl.gcommunicator.PublishMessageTask.execute(PublishMessageTask.java:129) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at serverconnection.DataUploadingService$Upload.doInBackground(DataUploadingService.java:181) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at serverconnection.DataUploadingService$Upload.doInBackground(DataUploadingService.java:152) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:292) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1115) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:590) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at java.lang.Thread.run(Thread.java:818) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: Caused by: java.io.IOException: Error getting access token for service account: 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.google.auth.oauth2.ServiceAccountCredentials.refreshAccessToken(ServiceAccountCredentials.java:227) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.google.auth.oauth2.OAuth2Credentials.refresh(OAuth2Credentials.java:97) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.google.auth.oauth2.OAuth2Credentials.getRequestMetadata(OAuth2Credentials.java:74) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at io.grpc.auth.ClientAuthInterceptor.getRequestMetadata(ClientAuthInterceptor.java:148) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at io.grpc.auth.ClientAuthInterceptor.access$100(ClientAuthInterceptor.java:61) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at io.grpc.auth.ClientAuthInterceptor$1.checkedStart(ClientAuthInterceptor.java:94) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at io.grpc.ClientInterceptors$CheckedForwardingClientCall.start(ClientInterceptors.java:164) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at io.grpc.stub.ClientCalls.startCall(ClientCalls.java:245) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at io.grpc.stub.ClientCalls.asyncUnaryRequestCall(ClientCalls.java:225) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: at io.grpc.stub.ClientCalls.futureUnaryCall(ClientCalls.java:186) 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: ... 11 more 09-20 11:06:04.608 1584-2301/com.example.stl.sciocardioapp W/System.err: Caused by: javax.net.ssl.SSLHandshakeException: Handshake failed 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:390) 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.android.okhttp.Connection.upgradeToTls(Connection.java:201) 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.android.okhttp.Connection.connect(Connection.java:155) 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:276) 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:211) 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:392) 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:116) 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:227) 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218) 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:25) 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:77) 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:965) 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.google.auth.oauth2.ServiceAccountCredentials.refreshAccessToken(ServiceAccountCredentials.java:225) 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: ... 20 more 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb8aad038: Failure in SSL library, usually a protocol error 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: error:14077102:SSL routines:SSL23_GET_SERVER_HELLO:unsupported protocol (external/openssl/ssl/s23_clnt.c:740 0xabf2ddfd:0x00000000) 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:318) 09-20 11:06:04.618 1584-2301/com.example.stl.sciocardioapp W/System.err: ... 32 more
I'm sending data every 60 seconds through pubsub
I have followed your example that described Cloud PubSub (gRPC) with Android. It works fine alone. But when I add the same code and dependencies to my existing project got following error.
09-15 11:36:14.812 31956-32764/com.example.stl.sciocardioapp E/art: Verification failed on class com.google.pubsub.v1.PubsubMessage$Builder in /data/data/com.example.stl.sciocardioapp/files/instant-run/dex/slice-grpc-pubsub-v1-0.0.2_df54ceb8a9a1043c6f69c84936a145dd371840e5-classes.dex because: Verifier rejected class com.google.pubsub.v1.PubsubMessage$Builder due to bad method com.google.pubsub.v1.PubsubMessage$Builder com.google.pubsub.v1.PubsubMessage$Builder.setPublishTime(com.google.protobuf.Timestamp) 09-15 11:36:14.812 31956-32764/com.example.stl.sciocardioapp E/ACRA: ACRA caught a RuntimeException for com.example.stl.sciocardioapp java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:304) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1115) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:590) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.VerifyError: Verifier rejected class com.google.pubsub.v1.PubsubMessage$Builder due to bad method com.google.pubsub.v1.PubsubMessage$Builder com.google.pubsub.v1.PubsubMessage$Builder.setPublishTime(com.google.protobuf.Timestamp) (declaration of 'com.google.pubsub.v1.PubsubMessage$Builder' appears in /data/data/com.example.stl.sciocardioapp/files/instant-run/dex/slice-grpc-pubsub-v1-0.0.2_df54ceb8a9a1043c6f69c84936a145dd371840e5-classes.dex) at com.google.pubsub.v1.PubsubMessage.toBuilder(PubsubMessage.java:382) at com.google.pubsub.v1.PubsubMessage.newBuilder(PubsubMessage.java:376) at com.stl.gcommunicator.PublishMessageTask.execute(PublishMessageTask.java:122) at serverconnection.DataUploadingService$Upload.doInBackground(DataUploadingService.java:183) at serverconnection.DataUploadingService$Upload.doInBackground(DataUploadingService.java:154) at android.os.AsyncTask$2.call(AsyncTask.java:292) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1115) at java.util.concurrent.ThreadPoolExecutor$Worker.run
Can someone help me to overcome with this problem
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.