Skip to content

Add support for AGP 9.0.0#10

Merged
jeprubio merged 7 commits into
mainfrom
feature/ANDROID-17380-agp9
Feb 10, 2026
Merged

Add support for AGP 9.0.0#10
jeprubio merged 7 commits into
mainfrom
feature/ANDROID-17380-agp9

Conversation

@jeprubio

@jeprubio jeprubio commented Feb 10, 2026

Copy link
Copy Markdown

🎟️ Jira ticket

ANDROID-17380

🥅 What's the goal?

Add support for gradle 9 & agp 9.

🚧 How do we do it?

  • Remove the check for VersionNumber as it has been removed.

To run the plugin locally with the sample app:

  • Uncomment the lines in settings.gradle.kts and the build.gradle.kts of the project. (Search for "// Uncomment")

./gradlew jar
./gradlew publishToMavenLocal
./gradlew checkPermissions

  • Update some manifest files of the sample app and rerun checkPermissions.

To run the tests:

./gradlew test

Tests also run on CI.

Comment thread .github/workflows/ci.yml
uses: actions/checkout@v6

- name: Cache Gradle dependencies
uses: actions/cache@v2

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It was failing as actions/cache@v2 is deprecated: https://github.com/Telefonica/android-permissioncheck/actions/runs/21857243109 so I've updated both actions.

object Versions { // See https://mvnrepository.com
const val JUNIT_5 = "5.7.1"
const val JUNIT_5 = "5.13.4"
const val JUNIT_PLATFORM_LAUNCHER ="1.7.1"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The JUNIT_PLATFORM_LAUNCHER is now needed because recent versions of Gradle and the Android Gradle Plugin (AGP) have updated their test infrastructure to use the JUnit Platform as the default test engine. This change means that, for custom test runners, plugins, or advanced test configurations, the junit-platform-launcher dependency must be explicitly included to ensure tests are discovered and executed correctly.

internal object TaskConfiguratorFactory {

fun getTaskConfigurator(): TaskConfigurator {
val version = VersionNumber.parse(getAndroidGradlePluginVersion())

@jeprubio jeprubio Feb 10, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

VersionNumber is either removed or no longer public and can't be used. It wasn't intended for public usage according to https://stackoverflow.com/questions/69967885/whats-the-successor-of-org-gradle-util-versionnumber

}

android {
namespace = "com.telefonica.manifestcheck.sample.app"

@jeprubio jeprubio Feb 10, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The namespace has to be moved from the manifest files to the gradle files when upgrading.

private val GRADLE_VERSIONS = listOf(
"7.4.2",
"7.2",
"9.1.0",

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The gradle version we test

// See https://developer.android.com/studio/releases/gradle-plugin
private val AGP_VERSIONS = listOf(
"7.0.0",
"9.0.0",

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The agp version we test


val manifestFile = androidProject.appDir.resolve("src").resolve("main").resolve("AndroidManifest.xml")
manifestFile.writeText(manifestFile.readText().replace("simonschiller", "johndoe")) // Trigger change
manifestFile.writeText(manifestFile.readText().replace("<manifest", "<!-- comment -->\n<manifest")) // Trigger change

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

We can't update anymore the namespace which has been moved from the manifest to the gradle file so it seems safer to just add a comment in that file.


group = "com.telefonica"
version = "1.0.2" // Also update the version in the README
version = "1.1.0" // Also update the version in the README

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The new version of this plugin

Comment on lines 51 to 52
website = "https://github.com/Telefonica/android-permissioncheck"
vcsUrl = "https://github.com/Telefonica/android-permissioncheck"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.github.simonschiller.permissioncheck.sample.app">

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Package has to be removed and added as namespace in the gradle files

Comment on lines +11 to +12
minSdk = 24
targetSdk = 36

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I've updated the target and minSdk versions in this sample app project with more actual values

@jeprubio
jeprubio requested a review from Copilot February 10, 2026 08:48

Copilot AI 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.

Pull request overview

Adds compatibility updates for running/building the plugin and samples with Gradle 9 and Android Gradle Plugin (AGP) 9 by modernizing Android DSL usage, updating dependency versions, and tweaking CI/test scaffolding to align with newer tooling.

Changes:

  • Updated sample + test Android project configuration (namespace, new Android DSL, lint block) and removed manifest package attributes.
  • Bumped Gradle wrapper / AGP dependency targets and adjusted JUnit runtime dependencies for Gradle 9/JUnit Platform.
  • Simplified AGP task configurator selection by removing version parsing logic.

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
sample/library/src/main/AndroidManifest.xml Removes manifest package attribute in favor of Gradle namespace.
sample/library/build.gradle.kts Migrates to namespace, compileSdk, minSdk, and new lint DSL.
sample/app/src/main/AndroidManifest.xml Removes manifest package attribute in favor of Gradle namespace.
sample/app/build.gradle.kts Migrates to namespace, compileSdk, minSdk/targetSdk, and new lint DSL.
plugin-core/build.gradle.kts Sets Java compatibility to 17; adds AGP 9 compileOnly and JUnit platform launcher runtime.
manifestcheck/src/test/kotlin/.../TestVersions.kt Removes VersionNumber compatibility filtering; targets Gradle 9.1.0 + AGP 9.0.0.
manifestcheck/src/test/kotlin/.../AndroidProjectExtension.kt Updates generated build script to set namespace and new lint DSL; updates manifest template.
manifestcheck/src/test/kotlin/.../SingleVariantPermissionCheckIntegrationTest.kt Changes manifest mutation strategy to not rely on removed manifest package.
manifestcheck/src/test/kotlin/.../MultiVariantPermissionCheckIntegrationTest.kt Changes manifest mutation strategy to not rely on removed manifest package.
manifestcheck/src/main/kotlin/.../TaskConfiguratorFactory.kt Removes AGP version detection and always selects TaskConfiguratorV1.
manifestcheck/build.gradle.kts Bumps plugin version + AGP compileOnly; configures JAR task deps and JUnit Platform.
gradle/wrapper/gradle-wrapper.properties Updates Gradle wrapper distribution to 9.1.0.
buildSrc/src/main/kotlin/Dependencies.kt Updates JUnit Jupiter version; adds JUnit Platform launcher constant/version.
README.md Updates published plugin version references to 1.1.0.
.java-version Removes pinned Java version file.
.github/workflows/ci.yml Updates GitHub Actions versions for checkout/cache.
Comments suppressed due to low confidence (1)

manifestcheck/src/test/kotlin/io/github/simonschiller/permissioncheck/testutil/AndroidProjectExtension.kt:1

  • namespace has been migrated, but the generated test project is still using the older compileSdkVersion(...), minSdkVersion(...), and targetSdkVersion(...) DSL. Since this PR targets AGP 9, it’s safer to migrate these to the modern properties (compileSdk = ..., defaultConfig { minSdk = ...; targetSdk = ... }) to avoid DSL removals/deprecations and keep the generated test build scripts consistent with the sample modules.
package io.github.simonschiller.permissioncheck.testutil

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread buildSrc/src/main/kotlin/Dependencies.kt Outdated
Comment thread buildSrc/src/main/kotlin/Dependencies.kt
Comment thread buildSrc/src/main/kotlin/Dependencies.kt Outdated
@jeprubio
jeprubio requested review from a team, jeslat and yamal-alm and removed request for a team February 10, 2026 08:53
jeprubio and others added 2 commits February 10, 2026 09:54

@yamal-alm yamal-alm 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 returns [TaskConfiguratorV1], as only V1 is supported for AGP 7.0.0+ (including 9.0.0).
*/
internal object TaskConfiguratorFactory {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do we really need the factory? Maybe we can remove it directly

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sure, yup, 04a06f9

@jeprubio
jeprubio requested a review from jeslat February 10, 2026 10:02

@jeslat jeslat 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.

Nice

@jeprubio
jeprubio merged commit d760b4e into main Feb 10, 2026
1 check passed
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.

4 participants