我正在尝试运行来自 https://github.com/grpc/grpc/tree/master/examples/android/helloworld 的示例.
我检查过我有:
安卓开发工具包 安卓NDK 协议(protocol) grpc_cpp_plugin
此外,我还在存储库中运行 git submodule update --init 以下载所有依赖项。
当我运行/gradlew installDebug --stacktrace
我收到这个错误:
Error while executing process
/Users/myuser/Library/Android/sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /Users/..path../exampleAndroidUsingCPP/grpc/examples/android/helloworld/app/.externalNativeBuild/cmake/debug/x86 --target protoc}
[1/98] Generating ../../../../../../../../../../../../third_party/protobuf/src/google/protobuf/compiler/js/well_known_types_embed.cc
FAILED: cd /Users/..path../exampleAndroidUsingCPP/grpc/examples/android/helloworld/app/.externalNativeBuild/cmake/debug/grpc/outputs/x86/third_party/protobuf && js_embed /Users/..path../exampleAndroidUsingCPP/grpc/third_party/protobuf/src/google/protobuf/compiler/js/well_known_types/any.js /Users/..path../exampleAndroidUsingCPP/grpc/third_party/pr tobuf/src/google/protobuf/compiler/js/well_known_types/struct.js /Users/..path../exampleAndroidUsingCPP/grpc/third_party/protobuf/src/google/protobuf/compiler/js/well_known_types/timestamp.js > /Users/..path../exampleAndroidUsingCPP/grpc/third_party/protobuf/src/google/protobuf/compiler/js/well_known_types_embed.cc
/bin/sh: js_embed: command not found
ninja: build stopped: subcommand failed.
我在 OSX 中运行它
知道在哪里可以修复它吗?
谢谢
最佳答案
为 Android 构建 gRPC C++ 需要修复 protobuf 构建规则 ( https://github.com/google/protobuf/pull/3878 ),该规则已合并到 master 但尚未发布。
如 https://github.com/grpc/grpc/blob/master/examples/android/helloworld/README.md 中所述,目前您必须手动将此拉取请求修补到 third_party/protobuf
中,然后再为 Android 构建 gRPC。您可以使用 grpc 存储库根目录中的以下命令执行此操作:
cd third_party/protobuf
git cherry-pick cba18efe1861d1fc1eecd6dc2af86fc1f0d9922f
关于android - well_known_types_embed.cc -/bin/sh : js_embed: command not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50840444/