当前位置: 萬仟网 > 移动技术>移动开发>Android > Android studio Kotlin中配置GRPC和protobuf时出现的一些问题总结

Android studio Kotlin中配置GRPC和protobuf时出现的一些问题总结

2018年12月11日  | 萬仟网移动技术  | 我要评论
android studio kotlin中配置grpc和protobuf时出现的一些问题总结 kotlin中配置 grpc和protobuf 出现一些问题总结如下: 3rd-party gradl

android studio kotlin中配置grpc和protobuf时出现的一些问题总结

kotlin中配置 grpc和protobuf 出现一些问题总结如下:

3rd-party gradle plug-ins may be the cause

codegen plugin grpc not defined

execution failed for task ‘:app:generatedebugproto’. > codegen plugin javalite not defined

io.grpc.statusruntimeexception: unimplemented: method not found


android studio运行不起来首先要找到打印出来的日志

1. 出现log信息

运行时弹出来的日志信息

2. 查看详细log信息

这里写图片描述


看看第一个问题

3rd-party gradle plug-ins may be the cause

the com.google.protobuf plugin was already applied to the project: :app and will not be applied again after plugin: android
usenewcruncher has been deprecated. it will be removed in a future version of the gradle plugin. new cruncher is now always enabled.

configure successful in 0s

这里写图片描述

第二个问题

codegen plugin grpc not defined

executing tasks: [:app:generatedebugsources]

configuration on demand is an incubating feature.
the com.google.protobuf plugin was already applied to the project: :app and will not be applied again after plugin: android
usenewcruncher has been deprecated. it will be removed in a future version of the gradle plugin. new cruncher is now always enabled.
:app:prebuild up-to-date
:app:predebugbuild up-to-date
:app:compiledebugaidl up-to-date
:app:compiledebugrenderscript up-to-date
:app:checkdebugmanifest up-to-date
:app:generatedebugbuildconfig up-to-date
:app:extractdebugproto up-to-date
:app:extractincludedebugproto up-to-date
:app:extractproto up-to-date
:app:generatedebugproto
a problem was found with the configuration of task ':app:generatedebugproto'. registering invalid inputs and outputs via taskinputs and taskoutputs methods has been deprecated and is scheduled to be removed in gradle 5.0.
 - directory '/volumes/document/mt5/flashlight/app/build/extracted-include-protos/main' specified for property '$3' does not exist.
:app:generatedebugproto failed

failure: build failed with an exception.

* what went wrong:
execution failed for task ':app:generatedebugproto'.
> codegen plugin grpc not defined

* try:
run with --stacktrace option to get the stack trace. run with --info or --debug option to get more log output. run with --scan to get full insights.

* get more help at https://help.gradle.org

build failed in 0s
9 actionable tasks: 1 executed, 8 up-to-date

这里写图片描述

如下

//https://github.com/rouzwawi/grpc-kotlin
protobuf {
 protoc { artifact = 'com.google.protobuf:protoc:3.5.1-1' }
 plugins {
  javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" }
  //增加grpc插件
  grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.13.1' // current_grpc_version
  }
 }
 generateprototasks {
  all().each { task ->
task.plugins {
 javalite {}
 grpc { // options added to --grpc_out
  option 'lite' }
}
  }
 }
}

第三个问题

client error: io.grpc.statusruntimeexception: unknown

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
Copyright © 2017-2021  萬仟网 保留所有权利. 粤ICP备17035492号-1
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com