5

How to compile C++ gRPC code for Android? I have seen several tutorials on how Protobuf itself can be compiled using the Android Native Development Kit, such as in the answer from Swapnil: How to integrate/install latest c++ protobuf (3.2) with Android NDK?

Or Google protobuf and Android NDK

But how to How to compile C++ gRPC code that is using Protobuf as well for Android? Taking into account that there's 20K lines of gRPC Makefile.

Taier
  • 2,091
  • 11
  • 22
  • 1
    gRPC has a CMakeLists.txt. Glancing at it, I see nothing that should prevent it to be used to generate NDK targets, – Frank Jan 03 '18 at 20:49
  • Did you eventually make it? – Michael Litvin Sep 06 '18 at 08:41
  • @David how my question can be a duplicate, if it was asked more than a year ago and this one just a few days ago? Also my question is not only about compiling gRPC, but protobuf as well. – Taier Jan 18 '19 at 07:15
  • @Taier Ok I mark this other question as duplicate of yours. And the other question has answers addressing grpc and protobuf compilation as grpc depends on protobuf package : building grpc leads to building protobuf – david Jan 18 '19 at 13:32

1 Answers1

0

I've done it here.

In brief: git submodule gRPC C++, add "CMakeLists.txt" file to your project on how to build C++ gRPC (and your code that uses it), add a externalNativeBuild/cmake it to your "build.gradle" - voila!

4ntoine
  • 18,878
  • 17
  • 83
  • 196