<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      Protobuf + gRPC Android Studio接入指南

        一.添加protobuf-gradle-plugin插件

      1.項(xiàng)目根目錄build.gradle里添加:

      buildscript {
        repositories {
          mavenCentral()
        }
        dependencies {
          classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.6'
        }
      }

      2.Module下build.gradle里添加:

      Android插件必須在Protobuf插件之前:

      apply plugin: 'com.android.application'  // or 'com.android.library'
      apply plugin: 'com.google.protobuf'

      設(shè)置proto文件位置(src/main/proto):

      android {
        sourceSets {
          main {
            proto {
              srcDir 'src/main/proto'
              ...
            }
          }
        }
      }   

      自定義Protobuf編譯項(xiàng):

      android {
          protobuf {
              // Configure the protoc executable
              protoc {
                  // Download from repositories
                  artifact = 'com.google.protobuf:protoc:3.6.1' // 這里可以手工指定 path = '/usr/local/bin/protoc'
              }
              plugins {
                  // Optional: an artifact spec for a protoc plugin, with "grpc" as
                  // the identifier, which can be referred to in the "plugins"
                  // container of the "generateProtoTasks" closure.
                  javalite {
                      artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0"
                  }
              }
              generateProtoTasks {
                  all()*.plugins {
                      javalite {}
      
                  }
              }
          }
      
      }

      加入依賴包:

      dependencies {
        // You need to depend on the lite runtime library, not protobuf-java
        api 'com.google.protobuf:protobuf-lite:3.0.1'
      api "javax.annotation:javax.annotation-api:1.2" //這個(gè)依賴是解決注釋報(bào)錯(cuò)的問題
      }

       

      同步.rebuild 至此build/generated/source/proto/目錄下生成相對(duì)應(yīng)的XxxOuterClass文件

       

      引用:

      1)https://github.com/google/protobuf-gradle-plugin

      2)https://search.maven.org/search?q=g:com.google.protobuf

      3)https://blog.csdn.net/YongYu_IT/article/details/80430318

       

      :

      引用1)中有句話Android projects: no default output will be added. Since Protobuf 3.0.0, protobuf-lite is the recommended Protobuf library for Android, and you will need to add it as a codegen plugin.大概意思是Android的項(xiàng)目是沒有默認(rèn)的輸出類型這個(gè)不同于GO,PHP,PYTHON的項(xiàng)目,從Protobuf 3.0.0后,在Android項(xiàng)目中推薦使用protobuf-lite為做為引用庫.這一點(diǎn)尤為重要,不然在后面grpc的生成時(shí)很容易出錯(cuò),該庫對(duì)應(yīng)的版本號(hào)通過引用2)進(jìn)行查看

       

      二.grpc代碼生成

      1.在protobuf選項(xiàng)增加相應(yīng)代碼

      android {
          protobuf {
              // Configure the protoc executable
              protoc {
                  // Download from repositories
                  artifact = 'com.google.protobuf:protoc:3.6.1'
              }
              plugins {
                  // Optional: an artifact spec for a protoc plugin, with "grpc" as
                  // the identifier, which can be referred to in the "plugins"
                  // container of the "generateProtoTasks" closure.
                  javalite {
                      artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0"
                  }
                  grpc {
                      artifact = "io.grpc:protoc-gen-grpc-java:1.14.0"
                  }
              }
              generateProtoTasks {
                  all()*.plugins {
                      javalite {}
                      grpc {
                          option 'lite'
                      }
                  }
              }
          }
      
      }

      2.加入依賴包:

      api 'io.grpc:grpc-okhttp:1.14.0'
      api 'io.grpc:grpc-protobuf-lite:1.14.0'
      api'io.grpc:grpc-stub:1.14.0'

      引用:

      1)https://github.com/grpc/grpc-java

       

      posted @ 2018-08-27 19:56  落葉已飛  閱讀(1849)  評(píng)論(0)    收藏  舉報(bào)
      主站蜘蛛池模板: 视频一区视频二区制服丝袜 | 亚洲第一无码专区天堂| 柳河县| 一区二区三区四区高清自拍| 69天堂人成无码免费视频| 日本亚洲色大成网站www久久| 精品人妻伦一二三区久久| 亚洲av激情久久精品人| 欧美18videosex性欧美tube1080| 亚洲色偷偷色噜噜狠狠99| 十八禁日本一区二区三区| 人人妻人人狠人人爽天天综合网| 国产午夜福利免费入口| 4虎四虎永久在线精品免费| 久久精品国产91精品亚洲| 亚洲av色香蕉一二三区| 国产普通话对白刺激| 97超级碰碰碰碰久久久久| 国产精品亚洲а∨天堂2021| 欧美性猛交xxxx乱大交丰满| 狠狠躁夜夜躁人人爽天天5| 偷拍久久大胆的黄片视频| 精品久久久久久成人AV| 国产精品免费视频网站 | 国产亚洲一区二区三区成人| 扒开双腿猛进入喷水高潮叫声| 瑞丽市| 精品久久久久无码| 男人进女人下部全黄大色视频 | 中文字幕人妻色偷偷久久| 国产在线不卡精品网站| 日韩av高清在线看片| 无码内射成人免费喷射| 久久亚洲精品11p| 亚洲精品网站在线观看不卡无广告 | 国产精品午夜福利免费看| 亚洲国产日韩一区三区| 欧美日激情日韩精品嗯| 国产午夜福利小视频在线| 国产一区二区三区av在线无码观看| 欧美成aⅴ人高清免费|