feat: Adopt AGP v9#9666
Open
hurali97 wants to merge 9 commits into
Open
Conversation
hurali97
commented
Jun 15, 2026
Comment on lines
252
to
256
| if (project != rootProject && SHOULD_ENABLE_AGP_FALLBACK) { | ||
| tasks.withType<KotlinCompile>().configureEach { | ||
| compilerOptions { | ||
| jvmTarget = JvmTarget.fromTarget("17") | ||
| } |
Author
There was a problem hiding this comment.
hurali97
commented
Jun 15, 2026
Comment on lines
-285
to
300
| if (project != rootProject) { | ||
| kotlin { | ||
| if (project != rootProject && SHOULD_ENABLE_AGP_FALLBACK) { | ||
| tasks.withType<KotlinCompile>().configureEach { | ||
| compilerOptions { | ||
| jvmTarget = JvmTarget.fromTarget("17") | ||
| } |
hurali97
commented
Jun 15, 2026
Comment on lines
8
to
17
| if (requested.id.id.startsWith("com.android")) { | ||
| useModule("com.android.tools.build:gradle:8.13.1") | ||
| useModule("com.android.tools.build:gradle:9.2.1") | ||
| } | ||
| if (requested.id.id == "com.diffplug.spotless") { | ||
| useModule("com.diffplug.spotless:spotless-plugin-gradle:8.1.0") | ||
| } | ||
| if (requested.id.id.startsWith("org.jetbrains.kotlin")) { | ||
| useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.20") | ||
| } | ||
| } |
Author
There was a problem hiding this comment.
For AGP - We can define the latest v9.2.1, however this gets overwritten by react-native-gradle-plugin anyways.
For KGP - With AGP 9, this gets overwritten by AGP itself, so we can leave it as is.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
This PR is rasied following the second phase of the RFC around AGP v9 adoption:
RFC: react-native-community/discussions-and-proposals#1006
The gist of this PR is to make Reanimated and Worklets AGP v9 compliant with backward compatibility. The main scope of changes is the
react-native-reanimated/android/build.gradleandreact-native-worklets/android/build.gradle. The rest of the changes can be considered temporary.The rest changes include:
Gradletov9.4.1proguard-android-optimizeproguard filegradle.propertiesIdeally, we should not enable the opt outs and leverage the AGP 9 built-in kotlin and newDSL. However, if we do not do it, then other libraries which are not yet AGP v9 compliant starts to fail. Hence, we need to keep the opt outs enabled for a while. For the context, react-native starting from 0.87.x will ship with AGP v9 and opt outs enabled by default for the new apps, which is the first phase of AGP v9 adoption.
With the second phase when the libraries starts adoption AGP v9, we can eventually remove the opt outs from Fabric Example.
Note:
react-native-gesture-handleras the updates contain a fix for not callingrootViewTagas a function invocationTest plan
To test this PR, we need to do a few steps:
agpversion to9.2.1andkotlinto2.2.0inreact-native-gradle-pluginreact-native-gradle-pluginThese step is only required because we have RN version on 0.85.2 and
AGP+kotlinbump will be shipped with 0.87.x.Verified on a local RN App with these changes applied
rn-app.mov
Verified by locally patching mmkv, safe-area, etc and making those AGP v9 compliant and removing the opt outs to test the changes in the PR
fabric-agp-9.mp4
Verified these changes work with AGP 8
agp-8.mp4