---
title: "How Swiggy Migrated from protobuf-java to Square Wire"
description: "Swiggy migrated from protobuf-java to Square Wire after profiling showed that the runtime and protoc-generated code consumed 6.735 MB of Android app size. protobuf-javalite was rejected because Swiggy relies extensively on google.protobuf.Any, while Wire retained support for Any and other well-known types with a smaller runtime and immutable Kotlin models. The migration required updating snake_case property access, message construction, serialization calls, ProGuard rules, and a custom pipeline that compiled all schemas together before publishing package-specific AARs to AWS CodeArtifact. The team also fixed repeated enum fields with [packed = true] after discovering a silent wire-format mismatch. It reduced Swiggy’s app size by 3.52 MB and produced measurable reductions for Instamart and Toing."
---

# How Swiggy Migrated from protobuf-java to Square Wire

[Swiggy](https://yomu.fyi/company/swiggy) · Balvinder Gambhir · Jul 10, 2026

**Type:** Problem & solution

## Summary

Swiggy migrated from protobuf-java to Square Wire after profiling showed that the runtime and protoc-generated code consumed 6.735 MB of Android app size. protobuf-javalite was rejected because Swiggy relies extensively on google.protobuf.Any, while Wire retained support for Any and other well-known types with a smaller runtime and immutable Kotlin models. The migration required updating snake\_case property access, message construction, serialization calls, ProGuard rules, and a custom pipeline that compiled all schemas together before publishing package-specific AARs to AWS CodeArtifact. The team also fixed repeated enum fields with \[packed = true\] after discovering a silent wire-format mismatch. It reduced Swiggy’s app size by 3.52 MB and produced measurable reductions for Instamart and Toing.

## Context

Swiggy found that protobuf-java and protoc-generated code consumed 6.735 MB of Android app size. protobuf-javalite was unsuitable because the app uses google.protobuf.Any extensively, and its runtime omits Any and other well-known types.

## Approach / What changed

Swiggy replaced protobuf-java with Square Wire, updating field access, message construction, encoding and decoding, and ProGuard configuration. A custom pipeline compiles the complete schema set in one pass, rebuilds changed packages and transitive dependents, creates package-specific AARs, and publishes them to AWS CodeArtifact.

## Takeaways

- Wire generates immutable Kotlin models with constructors and copy(), replacing protobuf-java’s Java builders and reducing generated-code overhead.
- Repeated enum fields required an explicit \[packed = true\] annotation in the .proto files because Wire otherwise encoded them unpacked, causing silent wire-format mismatches.
- R8 rules must preserve Wire’s reflective ADAPTER fields, @WireField annotations, enum fromValue(int) methods, and selected Companion names for JSON serialization to work.

**Tags:** [Android](https://yomu.fyi/topic/android), [Kotlin](https://yomu.fyi/topic/kotlin), [Protocol Buffers](https://yomu.fyi/topic/protobuf), [Square Wire](https://yomu.fyi/topic/square-wire)

- Source: [Swiggy](https://medium.com/swiggy-bytes/how-swiggy-migrated-from-protobuf-java-to-square-wire-e97d435c86d3)
- Source URL: https://medium.com/swiggy-bytes/how-swiggy-migrated-from-protobuf-java-to-square-wire-e97d435c86d3
- Ingested by Yomu: 2026-09-09T13:57:04.228Z

[Read original post](https://medium.com/swiggy-bytes/how-swiggy-migrated-from-protobuf-java-to-square-wire-e97d435c86d3)
