Does Google/Firebase android SDKs use GRPC?

怎甘沉沦 提交于 2020-03-05 09:33:09

问题


Recently I've been working on integrating a GRPC API in a size sensitive android app. The API only had a couple of Unary calls. I noticed that the resulting APK had io.grpc (613KB) & io.opencensus (178.9KB) which was further reduced to 387.2KB and 39.4KB respectively using Proguard. I noticed that Proguard was able to remove many streaming call related classes/methods from the APK. However, I noticed that the app already had com.google.protobuf package, which I suspect is from something like Firebase SDK.

If Firebase SDK imported com.google.protobuf, why didn't it need io.grpc for transport? Does it use something else?


回答1:


The protobuf protocol is used by some Firebase SDKs as part of their internal communications. The first one that comes to mind is Firebase Analytics, but there are others too.

The Cloud Firestore SDK in Firebase uses grpc as part of its transport protocol. If you're not using Cloud Firestore then the grpc library will not be included as far as I know.

To ensure that unused methods are removed, be sure to use ProGuard as part of your release build.



来源:https://stackoverflow.com/questions/55536657/does-google-firebase-android-sdks-use-grpc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!