Skip to content

fix: [SDK-4969] support AGP 9 Android builds - #42

Merged
fadi-george merged 3 commits into
mainfrom
fadi/sdk-4969
Jul 31, 2026
Merged

fix: [SDK-4969] support AGP 9 Android builds#42
fadi-george merged 3 commits into
mainfrom
fadi/sdk-4969

Conversation

@fadi-george

@fadi-george fadi-george commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Description

One Line Summary

Adds Android Gradle Plugin 9 compatibility while preserving AGP 8 support for existing Capacitor hosts.

Details

Motivation

AGP 9 removes the library targetSdk setter, enables built-in Kotlin, hides legacy Android DSL implementations, and rejects proguard-android.txt. These changes prevented the Capacitor plugin from configuring and building in AGP 9 host applications. Fixes #41.

Scope

  • Uses AGP 9 built-in Kotlin while retaining kotlin-android and explicit JVM targeting for AGP 8 hosts.
  • Migrates the plugin to the public library DSL and removes library-only targetSdk configuration.
  • Removes obsolete plugin ProGuard configuration and updates example applications to the supported optimized default.
  • Upgrades the primary demo to AGP 9.1.1 and Gradle 9.3.1 so Android Appium E2E continuously exercises AGP 9.
  • Keeps Capacitor 7 and the remaining Capacitor 8 fixtures on AGP 8 for compatibility coverage.
  • Does not change the plugin's public JavaScript API.

Testing

Unit testing

No new unit tests were needed because the change is limited to Gradle configuration. Existing test suite passes: 179 tests with 100% statement coverage.

Manual testing

  • Built the Capacitor 7 fixture with AGP 8.7.x, including Kotlin compilation.
  • Built the Capacitor 8 fixture with AGP 8.13.x.
  • Built the primary Capacitor 8 demo with AGP 9.1.1, Gradle 9.3.1, and JDK 21 without compatibility opt-out flags.
  • Built the no-location Android fixture.
  • Ran the primary demo's AGP 9 Android Appium suite: 32 passing, 2 skipped.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

Co-authored-by: Cursor <cursoragent@cursor.com>
@fadi-george
fadi-george requested a review from a team July 31, 2026 19:11

@sherwinski sherwinski left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It might be worth bumping one of the examples to use AGP 9, or create a new minimal one?

Comment thread android/build.gradle.kts Outdated
@fadi-george
fadi-george requested a review from sherwinski July 31, 2026 20:17
@fadi-george
fadi-george merged commit 08e464c into main Jul 31, 2026
6 checks passed
@fadi-george
fadi-george deleted the fadi/sdk-4969 branch July 31, 2026 21:13
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.

AGP 9.0+ Compatibility Crash: Unable to find method setTargetSdk in library module

2 participants