square / square/wire

Update the proguard rules with precise keep rules and bundle them as consumer-rules.pro

Open
#3,667 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
4.4k
Forks
627
Avg merge
3d 15m
Merged PRs (30d)
20

Description

The current documentation recommends broad keep rules
(-keep class com.yourcompany.yourgeneratedcode.** { *; }).

This prevents R8 from stripping unused generated protobuf models, leading to unnecessary app bloat.

Proposed Solution:

Replace the blanket documentation rules with granular ones that only preserve what Wire accesses reflectively (like ADAPTER, @WireField, and Enum Companions).

Ship these exact rules inside a consumer-rules.pro file within the Wire Android/Kotlin runtime artifact for a zero-config, optimized setup.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the current ProGuard guidance and the Android/Kotlin runtime artifact packaging. Review which reflective accesses require preservation, including ADAPTER, @WireField, and enum companions. Done means the documentation uses granular rules and the runtime artifact bundles them in consumer-rules.pro, with the relevant build verification passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
build-system, documentation, mobile-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.