Skip to content

bug: android/build.gradle uses removed proguard-android.txt : breaks with AGP 9.0 #775

@BenRacicot

Description

@BenRacicot

Plugin(s)

  • Accelerometer
  • Age Signals
  • Android Battery Optimization
  • Android Dark Mode Support
  • Android Edge-to-Edge Support
  • Android Foreground Service
  • App Review
  • App Shortcuts
  • App Update
  • Asset Manager
  • Audio Player
  • Audio Recorder
  • Background Task
  • Badge
  • Barometer
  • Biometrics
  • Bluetooth Low Energy
  • Cloudinary
  • Contacts
  • Datetime Picker
  • File Compressor
  • File Opener
  • File Picker
  • Geocoder
  • Google Sign-In
  • libSQL
  • Live Update
  • Managed Configurations
  • Media Session
  • NFC
  • OAuth
  • Pedometer
  • Photo Editor
  • Posthog
  • Purchases
  • Printer
  • RealtimeKit
  • Secure Preferences
  • Screen Orientation
  • Screenshot
  • Speech Recognition
  • Speech Synthesis
  • Share Target
  • Square Mobile Payments
  • SQLite
  • Superwall
  • Torch
  • Zip

Version

8.0.2 (eventually 9)

Platform(s)

  • Android
  • iOS
  • Web

Current behavior

Summary

@capawesome/capacitor-app-update@8.0.2 fails to build when the host project uses Android Gradle
Plugin 9.0+. AGP 9.0 removed support for getDefaultProguardFile('proguard-android.txt') and now
requires proguard-android-optimize.txt instead.

Error

A problem occurred evaluating project ':capawesome-capacitor-app-update'.

getDefaultProguardFile('proguard-android.txt') is no longer supported since it includes
-dontoptimize, which prevents R8 from performing many optimizations. Instead use
getDefaultProguardFile('proguard-android-optimize.txt'), and if needed, temporarily use
-dontoptimize in a custom keep rule file while fixing breakages.

Root Cause

https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/capacitor-app-update/andr
oid/build.gradle#L35:

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

Suggested Fix

  • proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  • proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

This is a backwards-compatible change — proguard-android-optimize.txt has been available since
AGP 3.4 and works on all AGP versions currently in use. It simply enables R8 optimizations that
proguard-android.txt was disabling.

Context

  • AGP 9.0.1 was released alongside Android Studio Narwhal Feature Drop (2025.2.1)
  • Capacitor 8 currently ships with AGP 8.13.0, so this isn't urgent yet, but projects that track
    the latest AGP or upgrade Android Studio will hit this
  • The same proguard-android.txt deprecation was a warning in AGP 8.x and became a hard error in
    9.0

Environment

  • @capawesome/capacitor-app-update: 8.0.2
  • @capacitor/android: 8.1.0
  • AGP: 9.0.1
  • Gradle: 9.2.1

Expected behavior

The plugin should build successfully with AGP 9.0+ without requiring any workarounds from the host project.

Reproduction

https://github.com/capawesome-team/capacitor-plugins

Steps to reproduce

  1. Create a Capacitor 8 project with @capawesome/capacitor-app-update@8.0.2
  2. Update android/build.gradle to AGP 9.0.1: classpath 'com.android.tools.build:gradle:9.0.1'
  3. Update Gradle wrapper to 9.2.1
  4. Run ./gradlew assembleDebug
  5. Build fails at project evaluation with the proguard-android.txt error

Other information

Wow, lots of hurdles to create a bug ticket!

Capacitor doctor

Latest Dependencies:

@capacitor/cli: 8.1.0
@capacitor/core: 8.1.0
@capacitor/android: 8.1.0
@capacitor/ios: 8.1.0

Installed Dependencies:

@capacitor/cli: 8.1.0
@capacitor/core: 8.1.0
@capacitor/android: 8.1.0
@capacitor/ios: 8.1.0

[success] Android looking great! 👌
[success] iOS looking great! 👌

Before submitting

  • I have read and followed the bug report guidelines.
  • I have attached links to possibly related issues and discussions.
  • I understand that incomplete issues (e.g. without reproduction) are closed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions