---
description: Learn how to fix Android Gradle Plugin 9 build errors in Capacitor apps caused by the deprecated proguard-android.txt file.
title: How to Fix Capacitor Plugin Build Errors with AGP 9 - Capawesome
image: https://capawesome.io/docs/assets/images/social/blog/how-to-fix-capacitor-plugin-build-errors-with-agp-9.png
---

[ Skip to content](#how-to-fix-capacitor-plugin-build-errors-with-agp-9) 

[ 🔐 Introducing the **Capacitor Vault** plugin — store secrets behind biometrics or a device passcode.](/blog/announcing-the-capacitor-vault-plugin/) 

* [  Formbricks ](/docs/plugins/formbricks/)
* [  Geocoder ](/docs/plugins/geocoder/)
* [  Google Sign-In ](/docs/plugins/google-sign-in/)
* [  Grafana Faro ](/docs/plugins/grafana-faro/)
* [  libSQL ](/docs/plugins/libsql/)
* [  Live Update ](/docs/plugins/live-update/)
* [  Managed Configurations ](/docs/plugins/managed-configurations/)
* [  Media Session ](/docs/plugins/media-session/)
* [  ML Kit ](/docs/plugins/mlkit/)
* [  Navigation Bar ](/docs/plugins/navigation-bar/)
* [  NFC ](/docs/plugins/nfc/)
* [  OAuth ](/docs/plugins/oauth/)
* [  Pedometer ](/docs/plugins/pedometer/)
* [  Photo Editor ](/docs/plugins/photo-editor/)
* [  PostHog ](/docs/plugins/posthog/)
* [  Printer ](/docs/plugins/printer/)
* [  Purchases ](/docs/plugins/purchases/)
* [  RealtimeKit ](/docs/plugins/realtimekit/)
* [  Screen Orientation ](/docs/plugins/screen-orientation/)
* [  Screenshot ](/docs/plugins/screenshot/)
* [  Secure Preferences ](/docs/plugins/secure-preferences/)
* [  Speech Recognition ](/docs/plugins/speech-recognition/)
* [  Speech Synthesis ](/docs/plugins/speech-synthesis/)
* [  Share Target ](/docs/plugins/share-target/)
* [  Square Mobile Payments ](/docs/plugins/square-mobile-payments/)
* [  SQLite ](/docs/plugins/sqlite/)
* [  Superwall ](/docs/plugins/superwall/)
* [  Torch ](/docs/plugins/torch/)
* [  Vault ](/docs/plugins/vault/)
* [  Wifi ](/docs/plugins/wifi/)
* [  Zip ](/docs/plugins/zip/)
* [  Cloud ](/docs/cloud/)
* [  Live Updates ](/docs/cloud/live-updates/)
* Advanced
* Integrations
* [  Native Builds ](/docs/cloud/native-builds/)
* [  Configuration ](/docs/cloud/native-builds/configuration/)
* [  Environments ](/docs/cloud/native-builds/environments/)
* Guides
* [  Sample Projects ](/docs/cloud/native-builds/sample-projects/)
* [  Troubleshooting ](/docs/cloud/native-builds/troubleshooting/)
* [  Automations ](/docs/cloud/automations/)
* [  Assist ](/docs/cloud/assist/)
* Account
* Organizations
* [  Organization and User Management ](/docs/cloud/organizations/memberships/)
* [  Single Sign-On (SSO) ](/docs/cloud/organizations/sso/)
* [  Teams ](/docs/cloud/organizations/teams/)
* [  Two-Factor Authentication ](/docs/cloud/organizations/two-factor-authentication/)
* [  Integrations ](/docs/cloud/integrations/)
* [  License Keys ](/docs/cloud/license-keys/)
* [  Webhooks ](/docs/cloud/webhooks/)
* [  Pricing ](https://capawesome.io/pricing/)
* [  FAQ ](/docs/cloud/faq/)
* [  Support ](/docs/cloud/support/)
* [  Contributing ](/docs/contributing/)
* [  LLMs ](/docs/llms/)
* [  Insiders ](/docs/insiders/)
* [  License ](https://capawesome.io/legal/eula/)
* [  Support ](/docs/insiders/support/)
* [  FAQ ](/docs/insiders/faq/)
* [  Blog ](/blog/)
* Categories

* [  Capawesome Plugins ](#capawesome-plugins)
* [  FAQ ](#faq)
* [  Stay Updated ](#stay-updated)
* [  Conclusion ](#conclusion)

# How to Fix Capacitor Plugin Build Errors with AGP 9[¶](#how-to-fix-capacitor-plugin-build-errors-with-agp-9 "Permanent link")

If you recently upgraded to Android Gradle Plugin (AGP) 9 in your Capacitor project, you may have noticed that your Android build suddenly fails. AGP 9 introduces a breaking change that affects Capacitor core and many Capacitor plugins. The good news: fixes are already available.

[ ![Build and deploy your Capacitor app with Capawesome Cloud](../../assets/external/cloud.capawesome.io/assets/banners/cloud-build-and-deploy-capacitor-apps.69628c3f.png) ](/) 

## The Problem[¶](#the-problem "Permanent link")

Android Studio may suggest upgrading your Android Gradle Plugin dependency from 8.x to 9.0.0\. After accepting this upgrade, your build fails with an error like this:

`` [](#%5F%5Fcodelineno-0-1)A problem occurred evaluating project ':app'.
[](#%5F%5Fcodelineno-0-2)> `getDefaultProguardFile('proguard-android.txt')` is no longer supported since it includes
[](#%5F%5Fcodelineno-0-3)`-dontoptimize`, which prevents R8 from performing many optimizations. Instead use
[](#%5F%5Fcodelineno-0-4)`getDefaultProguardFile('proguard-android-optimize.txt')`, and if needed, temporarily use
[](#%5F%5Fcodelineno-0-5)`-dontoptimize` in a custom keep rule file while fixing breakages.
 ``

The root cause is that AGP 9 [removed support](https://github.com/ionic-team/capacitor/issues/8314) for the `proguard-android.txt` default ProGuard file. This file was previously used by Capacitor core and many Capacitor plugins. Since AGP 9 now requires `proguard-android-optimize.txt` instead, any plugin still referencing the old file will cause the build to fail.

This affects not only your app's `build.gradle`, but also the `build.gradle` files of individual Capacitor plugins that ship their own ProGuard configuration.

## The Fix[¶](#the-fix "Permanent link")

There are two ways to resolve this issue:

### Option 1: Update Your Dependencies[¶](#option-1-update-your-dependencies "Permanent link")

The Capacitor team has already [merged a fix](https://github.com/ionic-team/capacitor/pull/8315) that replaces `proguard-android.txt` with `proguard-android-optimize.txt` in Capacitor core. The same fix has been applied to all official Capacitor plugins.

To resolve the issue, update `@capacitor/core`, `@capacitor/android`, and all official Capacitor plugins to their latest versions:

`[](#%5F%5Fcodelineno-1-1)npm install @capacitor/core@latest @capacitor/android@latest
`

Make sure to also update any official Capacitor plugins (e.g. `@capacitor/app`, `@capacitor/device`, etc.) to their latest versions.

### Option 2: Opt Out of the New Behavior[¶](#option-2-opt-out-of-the-new-behavior "Permanent link")

If you can't update all your dependencies right away, you can opt out of the breaking change by adding the following line to your `android/gradle.properties` file:

android/gradle.properties

`[](#%5F%5Fcodelineno-2-1)android.r8.proguardAndroidTxt.disallowed=false
`

This restores support for `proguard-android.txt` and allows your project to build with AGP 9 without updating any plugins. Note that this is only a temporary workaround and may be removed in a future AGP version.

## Capawesome Plugins[¶](#capawesome-plugins "Permanent link")

All Capacitor plugins from [Capawesome](/) are already compatible with AGP 9\. The fix has been included in the latest version of every Capawesome plugin, so simply updating to the latest version is all you need to do.

## FAQ[¶](#faq "Permanent link")

### How do I fix "proguard-android.txt is no longer supported"?[¶](#how-do-i-fix-proguard-androidtxt-is-no-longer-supported "Permanent link")

Replace `proguard-android.txt` with `proguard-android-optimize.txt` in your app's `build.gradle` and update all Capacitor plugins to their latest versions. Alternatively, add `android.r8.proguardAndroidTxt.disallowed=false` to your `gradle.properties` as a temporary workaround.

### Is this just a Capacitor issue?[¶](#is-this-just-a-capacitor-issue "Permanent link")

No. Any Android project or library that references `proguard-android.txt` will break with AGP 9\. Capacitor apps are commonly affected because both Capacitor core and many plugins used this file.

### Do I need to update all my plugins at once?[¶](#do-i-need-to-update-all-my-plugins-at-once "Permanent link")

Not necessarily. If you can't update everything immediately, use the `gradle.properties` opt-out flag to unblock your build while you update plugins incrementally.

### Will the opt-out flag work forever?[¶](#will-the-opt-out-flag-work-forever "Permanent link")

No. The `android.r8.proguardAndroidTxt.disallowed=false` flag is a temporary escape hatch. It may be removed in a future AGP version, so you should plan to update your dependencies.

### Does this affect Capacitor community plugins too?[¶](#does-this-affect-capacitor-community-plugins-too "Permanent link")

Yes. Any community plugin that references `proguard-android.txt` in its `build.gradle` will need to be updated. Check with the plugin maintainer or submit a PR replacing the file reference.

### Can I stay on AGP 8 to avoid this?[¶](#can-i-stay-on-agp-8-to-avoid-this "Permanent link")

Yes, staying on AGP 8.x avoids the issue entirely. However, future versions of Android Studio will eventually require AGP 9, so it's better to address the change sooner rather than later.

## Stay Updated[¶](#stay-updated "Permanent link")

Want to stay informed about Capacitor compatibility updates and new plugin releases? Subscribe to our newsletter:

[Subscribe to the Capawesome Newsletter](/newsletter/)

## Conclusion[¶](#conclusion "Permanent link")

AGP 9 introduces a breaking change by removing support for the `proguard-android.txt` default ProGuard file. This causes build failures in Capacitor apps and plugins that still reference it. The fix is straightforward: update Capacitor core, your plugins, and your app's `build.gradle` to use `proguard-android-optimize.txt` instead.

If you have questions or run into other issues, join the [Capawesome Discord server](https://discord.gg/VCXxSVjefW) to get help from the community. And don't forget to subscribe to the [Capawesome newsletter](/newsletter/) to stay up to date on the latest news and updates.

May 7, 2026 

 Back to top 