Greenstand / Greenstand/treetracker-android

Fix overly permissive ProGuard/R8 keep rule

Open
#1,230 0 comments 0 reactions 0 assignees View on GitHub
chore not ready for dev tech-debt triage
Dominant language
Kotlin
Stars
101
Forks
116
PR merge metrics
No merged PRs in 30d

Description

## Problem

`proguard-rules.pro` lines 35-37 contain:
```
-keep class * {
public private *;
}
```

This keeps **ALL** classes and all their public/private members, effectively defeating R8's dead code elimination, class merging, and name obfuscation. This significantly increases APK size and prevents optimization.

## Location

- `app/proguard-rules.pro` lines 35-37

## Suggested Fix

Remove the overly broad rule and replace with specific keep rules only for classes that are accessed via reflection or JNI. The existing AWS SDK, kotlinx-serialization, and AndroidX rules already cover the known reflection cases.

```diff
- -keep class * {
- public private *;
- }
```

**Important:** This change requires thorough testing of the release build to ensure no runtime `ClassNotFoundException` or `NoSuchMethodError` occurs. Test all major flows (login, tree capture, sync, messages) with the release/minified APK.

## Effort
Medium (requires thorough release build testing)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with app/proguard-rules.pro lines 35-37 and review the existing AWS SDK, kotlinx-serialization, and AndroidX rules. Remove the broad keep rule, build the release/minified APK, and test login, tree capture, sync, and messages. Done means these flows work without ClassNotFoundException or NoSuchMethodError and the APK retains the intended R8 optimization.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
build-system, mobile
Issue type
Refactor
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.