Skip to content

fix(android): remove jcenter() and legacy AGP buildscript pin for AGP 9 - #210

Open
ameyanaik11 wants to merge 1 commit into
justsoft:masterfrom
ameyanaik11:fix/agp9-remove-jcenter-legacy-buildscript
Open

fix(android): remove jcenter() and legacy AGP buildscript pin for AGP 9#210
ameyanaik11 wants to merge 1 commit into
justsoft:masterfrom
ameyanaik11:fix/agp9-remove-jcenter-legacy-buildscript

Conversation

@ameyanaik11

Copy link
Copy Markdown

What

Removes the legacy buildscript block in android/build.gradle that:

  • called jcenter(), which JFrog shut down in 2021 and which Gradle 9 no longer exposes a jcenter() repository method for at all
  • pinned its own separate AGP 4.1.0 classpath, and injected jcenter() into the consuming app's rootProject.allprojects repositories

Also applies com.android.library the standard way for a modern Flutter plugin module (no local AGP version pin — resolved from the consuming app's root project instead), migrates the deprecated lintOptions block to lint {}, and raises compileSdkVersion/minSdkVersion off the 2020-era defaults (33/16).

Why

Any app that depends on this plugin and builds with Android Gradle Plugin 9.x fails outright during Gradle configuration:

A problem occurred evaluating project ':video_thumbnail'.
> Could not find method jcenter() for arguments [] on repository container of type org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.

followed by a second failure because kotlin-android (applied by the consuming app or other plugins) can no longer find a working Android Gradle Plugin classpath once the sub-project's own broken buildscript block is evaluated. AGP 9.0 also defaults android.newDsl=true, which no longer tolerates a sub-project pulling in its own separate AGP classpath the old way.

Testing

Verified against a real app (Flutter 3.47.2, AGP 9.1.0, Gradle 9.3.1, Kotlin 2.4.0, compileSdk 37): the app's Gradle configuration now gets past :video_thumbnail cleanly with this change (confirmed by the jcenter/plugin-application errors disappearing from the build log; the app hit an unrelated compileSdk-minor-version issue afterwards, tracked separately).

I'm also considering PR #196 and #190 (both replace jcenter() with mavenCentral() without removing the rest of the legacy buildscript block) — this PR is a superset that also fixes the AGP-classpath and rootProject.allprojects side effects those don't address.

Action items

No action items.

🤖 Generated with Claude Code

- Remove the buildscript block that pinned AGP 4.1.0 and pulled it (and
  the app-level rootProject.allprojects repositories) from jcenter(),
  which JFrog shut down in 2021 and which Gradle 9 no longer even
  exposes a jcenter() repository method for. Modern Flutter plugins
  resolve their AGP/Gradle version from the consuming app's root
  project instead of pinning their own, so this block was both broken
  and unnecessary.
- Apply the plugin the standard way for a Flutter Android library
  module (apply plugin: 'com.android.library', no local version pin).
- Raise compileSdkVersion/minSdkVersion off the 2020-era defaults (33/16)
  to values consistent with current Flutter plugin conventions.
- Migrate the deprecated lintOptions block to lint {}.

This unblocks building any app that depends on this plugin under
Android Gradle Plugin 9.x, where the old buildscript-based
configuration fails outright (jcenter() is gone, and the app-level
android.newDsl=true default in AGP 9.0 no longer tolerates a
sub-project pulling in its own separate AGP classpath).
@ameyanaik11 ameyanaik11 changed the title Fix Android build for AGP 9 (remove jcenter(), legacy buildscript pin) fix(android): remove jcenter() and legacy AGP buildscript pin for AGP 9 Sep 10, 2026
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.

1 participant