Android中Protobuf集成使用
集成Protobuf到Android项目中的步骤如下
- 在
Project的build.gradle下加入protobuf插件
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.12'
- 在
module的build.gradle下添加配置
apply plugin: 'com.google.protobuf'
1 | android { |
3.make项目完成
XXPB.pb文件结构
1 | syntax = "proto3"; |
注:记得protobuf的生成类不要混淆
