-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Description
Is there an example or implementation of GRPC server (Java/C++) running on Android?
I am following grpc java server example to implement the server i
private class GrpcServerTask extends AsyncTask<Void, Void, String>{
@Override
protected void onPreExecute() {
}
@Override
protected String doInBackground(Void... params) {
int port = 50051;
Server server;
try {
server = ServerBuilder.forPort(port)
.addService(new GreeterImpl())
.build()
.start();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
private class GreeterImpl extends GreeterGrpc.GreeterImplBase {
@Override
public void sayHello(HelloRequest req, StreamObserver<HelloReply> responseObserver) {
HelloReply reply = HelloReply.newBuilder().setMessage("Hello " + req.getName()).build();
responseObserver.onNext(reply);
responseObserver.onCompleted();
}
}
I keep getting the error io.grpc.ManagedChannelProvider$ProviderNotFoundException: No functional server found. Try adding a dependency on the grpc-netty artifact
on executing new GrpcServerTask().execute();
Thanks
Metadata
Metadata
Assignees
Labels
No labels