Improve grpc library file size in iOS and Android build
See original GitHub issueThe document provides a way to strip debug symbols from libgrpc.a
, which reduce the file size from about 100m to 18m.
Meanwhile, the stripped libgrpc.a
is still a FAT file, which contains x86_64, armv7 and arm64 architecture. Since armv7 is already deprecated, we can use lipo
command to remove x86_64 and armv7 from it.
lipo libgrpc.a -remove x86_64 -remove armv7
The file size can be reduced to ~6M, if you are targeting arm64 devices only (iPhone 5s and later).
The libgrpc_csharp_ext.so
for Android platform can also be stripped by following command:
##Choose proper architecture
[NDK_PATH]\toolchains\aarch64-linux-android-4.9\prebuilt\windows-x86_64\aarch64-linux-android\bin\strip.exe" libgrpc_csharp_ext.so
The file size can be reduced from 46M to 3M
Hope these tips would help someone who hesitated because of client library file size.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:9
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Why is Grpc.Core NuGet package so big?
It turns out that for Android there are native libraries for three different architectures each around 50 MB and for iOS there is...
Read more >Build client-server applications with gRPC
The downside of using Cronet is the APK size increase, as adding the binary Cronet dependency will add >1MB to the app size,...
Read more >Performance Best Practices
A user guide of both general and language-specific best practices to improve performance.
Read more >Serving with gRPC - BentoML Documentation
Definition: The maximum message length in bytes allowed to be received on/can be send to the server. By default we set to -1...
Read more >Overview | Protocol Buffers Documentation
Protocol buffers provide a serialization format for packets of typed, structured data that are up to a few megabytes in size. The format...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Is it already thinned? A FAT file means it contains multiple archs in it. Try
lipo libgrpc.a -archs
to find out which archs it contains.It looks like grpc-unity-packaged is removed from grpc daily build page. Where can I download the latest version? @triste24 @bartutiryakioglu
Meanwhile, could you try that whether the version in this repo is still working? libgrpc.a