Skip to content

Conversation

@AnthonyRonning
Copy link
Contributor

@AnthonyRonning AnthonyRonning commented Jan 22, 2026

Summary

  • Fixed Android CI pipeline to properly process the $PACKAGE placeholder in the Tauri proguard template
  • The previous code was copying the raw template, causing R8/ProGuard rules to be invalid
  • This resulted in critical Kotlin classes being stripped from the APK

Root Cause

When the Android build pipeline was refactored to parallelize builds (PR #386), the step that copies proguard-tauri.pro was doing a direct copy without processing the $PACKAGE placeholder:

# Before (broken)
cp "$TAURI_PROGUARD" frontend/src-tauri/gen/android/app/proguard-tauri.pro

The Tauri template contains:

-keep class $PACKAGE.TauriActivity {

This was being copied as-is, so R8 couldn't match the rule and stripped TauriActivity and all other generated Kotlin classes.

Fix

Process the placeholder before copying:

sed "s/\$PACKAGE/$PACKAGE/g" "$TAURI_PROGUARD" > frontend/src-tauri/gen/android/app/proguard-tauri.pro

Test plan

  • Android build workflow completes successfully
  • APK contains all required classes (TauriActivity, Ipc, RustWebView, etc.)
  • App launches and functions correctly on Android device

Fixes #394

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Improved Android build tooling to perform package-name substitution in generated proguard rules instead of direct copying.
    • Added handling for additional proguard rules (Wry) with the same substitution behavior.
    • Preserved previous skip behavior and added explicit logging when proguard source files are absent.

✏️ Tip: You can customize this high-level summary in your review settings.


Open with Devin

The Tauri proguard-tauri.pro template file contains `$PACKAGE` placeholder
that needs to be substituted with the actual package name before use.
The previous code was copying the raw template, which meant the R8/ProGuard
rule `-keep class $PACKAGE.TauriActivity` was invalid and didn't match
anything, causing TauriActivity and related classes to be stripped.

This fixes the v2.0.13 Android app crash on launch issue where the APK
was missing critical Kotlin classes (TauriActivity, Ipc, RustWebView, etc.)
due to R8 stripping them.

Fixes #394

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

📝 Walkthrough

Walkthrough

GitHub Actions workflows updated to perform placeholder substitution for ProGuard files during Android builds: TAURI_PROGUARD now has $PACKAGE replaced via sed; a new WRY_PROGUARD block generates proguard-wry.pro by substituting {{package-unescaped}}. Missing files are skipped with log messages.

Changes

Cohort / File(s) Change Summary
Android CI workflow updates
.github/workflows/android-build.yml, .github/workflows/release.yml
Replaced direct copy of Tauri proguard with sed-based substitution of $PACKAGE. Added new handling for Wry proguard: sed substitution of {{package-unescaped}}frontend/src-tauri/gen/android/app/proguard-wry.pro. Both workflows log and skip when source files are absent.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰
A tiny rabbit hopped through the build,
Found placeholders lonely and unfulfilled,
With a whisker-tap of sed so spry,
$PACKAGE and names now properly fly,
Hooray — the APK greets morning sky! 🥕

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: processing proguard template placeholders before copying, which is the core fix addressing the Android crash.
Linked Issues check ✅ Passed Changes implement the required fix by processing $PACKAGE placeholder in Tauri proguard and {{package-unescaped}} in Wry proguard templates, directly addressing issue #394's root cause of stripped Kotlin classes.
Out of Scope Changes check ✅ Passed All changes are scoped to proguard template placeholder substitution in both android-build.yml and release.yml workflows, directly aligned with fixing the crash issue.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 22, 2026

Greptile Summary

Fixed critical Android build issue where proguard templates were being copied without processing placeholders, causing R8 to strip essential Kotlin classes and resulting in app crashes on launch.

Key Changes:

  • Changed Tauri proguard template handling from direct copy to sed processing, replacing $PACKAGE placeholder with actual package name
  • Added Wry proguard template processing (new in this PR) to handle {{package-unescaped}} placeholder
  • Applied fix consistently across both CI (android-build.yml) and production release (release.yml) workflows

Impact:

Confidence Score: 5/5

  • This PR is safe to merge - it fixes a critical production bug with a straightforward, well-tested solution
  • The fix directly addresses the root cause (unprocessed template placeholders) with proper sed substitution. The changes are identical in both workflows, consistent with existing template rendering patterns, and the sed syntax is correct. This fixes a production-breaking issue introduced in the parallelization refactor.
  • No files require special attention

Important Files Changed

Filename Overview
.github/workflows/android-build.yml Fixed proguard template processing by replacing direct file copy with sed to substitute package placeholders, preventing class stripping
.github/workflows/release.yml Applied identical proguard template processing fix as android-build.yml for production release builds

Sequence Diagram

sequenceDiagram
    participant CI as GitHub Actions
    participant Cargo as Cargo Metadata
    participant Templates as Tauri/Wry Templates
    participant Sed as sed Processor
    participant Gen as Generated Files
    participant R8 as R8/ProGuard

    CI->>Cargo: cargo metadata (get tauri/wry paths)
    Cargo-->>CI: TAURI_DIR, WRY_DIR paths
    
    Note over CI,Templates: Before (Broken in PR #386)
    CI->>Templates: Read proguard-tauri.pro
    Templates-->>CI: -keep class $PACKAGE.TauriActivity
    CI->>Gen: cp (direct copy)
    Gen-->>R8: -keep class $PACKAGE.TauriActivity
    Note over R8: ❌ R8 can't match literal "$PACKAGE"<br/>strips TauriActivity → crash
    
    Note over CI,R8: After (This Fix)
    CI->>Templates: Read proguard-tauri.pro
    Templates-->>CI: -keep class $PACKAGE.TauriActivity
    CI->>Sed: sed "s/\$PACKAGE/com.opensecret.maple/g"
    Sed-->>Gen: -keep class com.opensecret.maple.TauriActivity
    Gen-->>R8: -keep class com.opensecret.maple.TauriActivity
    Note over R8: ✓ R8 matches & preserves class
    
    CI->>Templates: Read proguard-wry.pro
    Templates-->>CI: -keep class {{package-unescaped}}.Ipc
    CI->>Sed: sed "s/{{package-unescaped}}/com.opensecret.maple/g"
    Sed-->>Gen: -keep class com.opensecret.maple.Ipc
    Gen-->>R8: -keep class com.opensecret.maple.Ipc
    Note over R8: ✓ R8 matches & preserves class
Loading

The Wry proguard-wry.pro template also contains placeholders that need
to be substituted. This file was not being copied/generated at all.

The template uses `{{package-unescaped}}` which needs to be replaced
with the actual package name (cloud.opensecret.maple).

Without this, R8 strips the Wry-related classes: Ipc, RustWebView,
RustWebChromeClient, RustWebViewClient, Logger, PermissionHelper, etc.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 22, 2026

Deploying maple with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5c3b5c0
Status: ✅  Deploy successful!
Preview URL: https://d641fb0a.maple-ca8.pages.dev
Branch Preview URL: https://fix-android-proguard-templat.maple-ca8.pages.dev

View logs

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.github/workflows/android-build.yml:
- Around line 376-379: The generated WRY proguard rules are being written to the
generated-sources dir ($GEN_KOTLIN_DIR) which is unreliable; instead, write the
processed WRY_PROGUARD output into the app module root (the same location used
for proguard-tauri.pro) so Gradle/R8 can find it. Update the sed redirection
that uses WRY_PROGUARD and PACKAGE to output proguard-wry.pro into the app root
(where proguard-tauri.pro is placed) rather than $GEN_KOTLIN_DIR, keeping the
filename proguard-wry.pro.

Comment on lines +376 to +379
# Wry proguard rules (process {{package-unescaped}} placeholder)
WRY_PROGUARD="$WRY_DIR/src/android/kotlin/proguard-wry.pro"
if [ -f "$WRY_PROGUARD" ]; then
sed "s/{{package-unescaped}}/$PACKAGE/g" "$WRY_PROGUARD" > "$GEN_KOTLIN_DIR/proguard-wry.pro"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's verify the Gradle references to proguard-wry.pro
rg -n --glob '*.gradle*' --glob '*.kts' 'proguard-wry\.pro'

Repository: OpenSecretCloud/Maple

Length of output: 47


🏁 Script executed:

# Also check for proguardFiles configuration in Gradle
rg -n --glob '*.gradle*' --glob '*.kts' 'proguardFiles'

Repository: OpenSecretCloud/Maple

Length of output: 146


🏁 Script executed:

# Let's examine the android-build.yml file to understand GEN_KOTLIN_DIR variable
cat -n .github/workflows/android-build.yml | sed -n '350,385p'

Repository: OpenSecretCloud/Maple

Length of output: 1913


🏁 Script executed:

# Find where GEN_KOTLIN_DIR is defined in the workflow
rg -n 'GEN_KOTLIN_DIR=' .github/workflows/android-build.yml

Repository: OpenSecretCloud/Maple

Length of output: 169


🏁 Script executed:

# Examine the Gradle proguardFiles configuration
cat -n frontend/src-tauri/gen/android/app/build.gradle.kts | sed -n '50,65p'

Repository: OpenSecretCloud/Maple

Length of output: 642


🏁 Script executed:

# Also check if there's a proguard-wry.pro file anywhere in the codebase
find . -name "proguard-wry.pro" 2>/dev/null

Repository: OpenSecretCloud/Maple

Length of output: 47


🏁 Script executed:

# Check if there are other .pro files in the codebase to understand the pattern
find . -name "*.pro" -type f 2>/dev/null

Repository: OpenSecretCloud/Maple

Length of output: 120


🏁 Script executed:

# Let's also check the context around the Gradle configuration to understand the working directory
cd frontend/src-tauri/gen/android/app && pwd

Repository: OpenSecretCloud/Maple

Length of output: 118


Write proguard-wry.pro to the app root directory, consistent with proguard-tauri.pro.

Line 379 writes the file to $GEN_KOTLIN_DIR (generated sources subdirectory), which is unreliable and inconsistent with how proguard-tauri.pro is placed directly in the app root on line 371. Gradle expects ProGuard rules in the app module root for reliable R8 processing.

🔧 Proposed fix
-            sed "s/{{package-unescaped}}/$PACKAGE/g" "$WRY_PROGUARD" > "$GEN_KOTLIN_DIR/proguard-wry.pro"
+            sed "s/{{package-unescaped}}/$PACKAGE/g" "$WRY_PROGUARD" > "frontend/src-tauri/gen/android/app/proguard-wry.pro"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Wry proguard rules (process {{package-unescaped}} placeholder)
WRY_PROGUARD="$WRY_DIR/src/android/kotlin/proguard-wry.pro"
if [ -f "$WRY_PROGUARD" ]; then
sed "s/{{package-unescaped}}/$PACKAGE/g" "$WRY_PROGUARD" > "$GEN_KOTLIN_DIR/proguard-wry.pro"
# Wry proguard rules (process {{package-unescaped}} placeholder)
WRY_PROGUARD="$WRY_DIR/src/android/kotlin/proguard-wry.pro"
if [ -f "$WRY_PROGUARD" ]; then
sed "s/{{package-unescaped}}/$PACKAGE/g" "$WRY_PROGUARD" > "frontend/src-tauri/gen/android/app/proguard-wry.pro"
🤖 Prompt for AI Agents
In @.github/workflows/android-build.yml around lines 376 - 379, The generated
WRY proguard rules are being written to the generated-sources dir
($GEN_KOTLIN_DIR) which is unreliable; instead, write the processed WRY_PROGUARD
output into the app module root (the same location used for proguard-tauri.pro)
so Gradle/R8 can find it. Update the sed redirection that uses WRY_PROGUARD and
PACKAGE to output proguard-wry.pro into the app root (where proguard-tauri.pro
is placed) rather than $GEN_KOTLIN_DIR, keeping the filename proguard-wry.pro.

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional flags.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2.0.13 Android app crashes on launch

2 participants