Skip to content

Fix #13282 Upgraded AGP version from 8.13.2 to 9.0.1#20410

Closed
aadityarshah wants to merge 2 commits intoankidroid:mainfrom
aadityarshah:fix/upgrade-agp-to-9-0-1
Closed

Fix #13282 Upgraded AGP version from 8.13.2 to 9.0.1#20410
aadityarshah wants to merge 2 commits intoankidroid:mainfrom
aadityarshah:fix/upgrade-agp-to-9-0-1

Conversation

@aadityarshah
Copy link

@aadityarshah aadityarshah commented Mar 6, 2026

Purpose / Description

The codebase was on AGP version 8.13.2 and on opening it on Android Studio, AGP Assistant recommended to upgrade it to 9.0.1 (latest version) which is what is the purpose of this PR.
To ensure compatibility with third-party plugins like Slack Keeper, android.builtInKotlin=false and android.newDsl=false have been used in gradle.properties.

Fixes

Fixes #13282 (Fix Android Studio Warnings)

Approach

  • Used the official release notes to apply the required changes:- https://developer.android.com/build/releases/agp-9-0-0-release-notes
  • The build.gradle.kts (AnkiDroid) had CommonExtension<*, *, *, *, *, *> but the parameterization of CommonExtension has been removed in AGP 9.0 hence, they were removed.
  • AGP Upgrade assistant was used to make the other required changes for upgrading to AGP 9.0.1
  • In api/build.gradle.kts, the getDefaultProguardFile("proguard-android.txt") was modified to getDefaultProguardFile("proguard-android-optimize.txt") as suggested on running ./gradlew assembleDebug command
  • On receiving multiple warnings to enable 'android.generateSyncIssueWhenLibraryConstraintsAreEnabled' as it was said to improve projects import performance for very large projects, the line 'android.generateSyncIssueWhenLibraryConstraintsAreEnabled=false' was added to gradle.properties
  • Fixed Groovy DSL property assignments of the form property (value) to property = name as required in AnkiDroid/build.gradle, e.g. testCoverageEnabled true to testCoverageEnabled = true
  • Resolved warnings in build.gradle.kts (AnkiDroid) since the values for ktlintVersion and minSDK were always going to be non-null.
  • Fixed task evaluation error in jacoco.gradle by using tasks.matching {it.name == 'testPlayDebugUnitTest'}.configureEach { task -> ...} ensuring the configuration is applied only when task is created.

How Has This Been Tested?

  • The Gradle Sync ran successfully
  • ./gradlew assembleDebug was ran using OpenJDK 24 version on Windows 11 and since it executed successfully, it was concluded that the changes have worked successfully.
  • Checked by deploying the :AnkiDroid module to an emulator which ran successfully

Learning (optional, can help others)

AGP 9.0 uses new DSL interfaces which have been implemented and some old DSL types are not compatible now such as BaseExtension.

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code

This commit upgrades the AGP version from 8.13.2 to 9.0.1 with required
changes in gradle files according to the official release notes provided
at https://developer.android.com/build/releases/agp-9-0-0-release-notes.
@ShaanNarendran
Copy link
Contributor

For android studio warnings, you can take 1 or 2 small warnings in any of the code files and fix those. I believe version upgrades like this are taken care of automatically, so you would have a guaranteed merge doing what I suggested!

@aadityarshah aadityarshah changed the title #13282 Upgraded AGP version from 8.13.2 to 9.0.1 Fix #13282 Upgraded AGP version from 8.13.2 to 9.0.1 Mar 6, 2026
@aadityarshah
Copy link
Author

Thank you for your guidance sir! I will revert back the AGP upgrade and work on fixing android studio warnings.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Cleanup]: Fix Android Studio Warnings

2 participants