-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to apply plugin 'com.facebook.react' #41580
Comments
|
Can you provide a reproducer? @harrymash2006 |
Sorry, I think this is not an issue on react native side. It just happens when I try to add a local custom module, so closing this. |
@harrymash2006 could you shed me some light which module caused this error? I simply upgraded react-native from 0.72.5 to 0.73.1 and started getting this error |
We are running into this also when upgrading to RN 0.73.0 - would love to know how this was resolved for you. |
Has anyone found a solution for this yet? |
the same here |
So I'm running into this when I'm trying to gradle 8 to run after upgrading to RN 0.7.3 (yes, I got it to build using gradle 7.6.4)... When I upgraded to gradle 8.0, I ran into this with one of my other packages A problem occurred configuring project ':amplitude_analytics-react-native'.
So I tried to apply the configuration per what I googled. When that is apply this setting android.defaults.buildfeatures.buildconfig=true However, then I see
My guess is some sort of incompatibility between competing packages wanting different things. |
I'm also facing this issue |
Same here, can't find any solution.. I've been looking during days |
Same here! |
I also have the same issue. AGP = 8.3.2 "devDependencies": { |
Hey @C2418M31, 2 days ago I stumbled upon the same error.
It's because the new React Native version has already the base version set, you can check this out in your project node module folder: node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/utils/JdkConfiguratorUtils.kt. You have two ways to solve it, chose one of them:
|
Hi @elisjoaquim I tried the two ways. 1: I tried to commented the
and the
and in my app gradle.kts file i retain the compile options.
And the result was: in my settings.gradle.kts. :
2: I tried the 2nd suggestion and remove in the app gradle.kts the compile options and retain in the node_modules the verison 17. and the output still the same with number 1. conflicting now with the settings repository. Thank @elisjoaquim you give a good insight about this. |
Hello @C2418M31, the previous issues seems to be solved, it now has to do with the dependency resolution configs you are using for Gradle.
Thanks! |
I'm encountering this error after i bumped to 0.73.8. my android has two modules app and instant-app. Is there any way to fix this issue? |
Have the same issue with gradle 8.2 and react native 0.72.10. |
Hi, I did the same:
If I find something useful I will report back here. Thank you |
Can you show the full logcat? or try to go to the file-> settings -> build tools and select appropriate jdk version then resync gradle. |
Interesting... I tried what @elisjoaquim suggested. To comment out the code in |
Hi there! I tried what @elisjoaquim suggested too (Comment out some lines in JdkConfiguratorUtils.kt). In an empty RN app everything works fine, app and InstantApp as well, but then when I import and use libraries like react-native-screens, react-native-safe-area-context and others I got the following error: Execution failed for task ':react-native-screens:compileDebugKotlin'.
I'm sure that this error is caused by commenting out that lines in JdkConfiguratorUtils.kt (I tested it) |
i patched diff --git a/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/utils/JdkConfiguratorUtils.kt b/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/utils/JdkConfiguratorUtils.kt
index 0d55714..e79f0e9 100644
--- a/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/utils/JdkConfiguratorUtils.kt
+++ b/node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/utils/JdkConfiguratorUtils.kt
@@ -15,6 +15,7 @@ import org.gradle.api.Project
import org.gradle.api.plugins.AppliedPlugin
import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtension
+// revert this file to RN 0.72 to fix https://github.com/facebook/react-native/issues/41580
internal object JdkConfiguratorUtils {
/**
* Function that takes care of configuring the JDK toolchain for all the projects projects. As we
@@ -22,31 +23,26 @@ internal object JdkConfiguratorUtils {
* configure the toolchain to 17.
*/
fun configureJavaToolChains(input: Project) {
- // Check at the app level if react.internal.disableJavaVersionAlignment is set.
if (input.hasProperty(INTERNAL_DISABLE_JAVA_VERSION_ALIGNMENT)) {
return
}
input.rootProject.allprojects { project ->
- // Allows every single module to set react.internal.disableJavaVersionAlignment also.
- if (project.hasProperty(INTERNAL_DISABLE_JAVA_VERSION_ALIGNMENT)) {
- return@allprojects
- }
val action =
Action<AppliedPlugin> {
- project.extensions.getByType(AndroidComponentsExtension::class.java).finalizeDsl { ext
- ->
+ project.extensions.getByType(AndroidComponentsExtension::class.java).finalizeDsl {
+ ext ->
ext.compileOptions.sourceCompatibility = JavaVersion.VERSION_17
ext.compileOptions.targetCompatibility = JavaVersion.VERSION_17
}
}
project.pluginManager.withPlugin("com.android.application", action)
project.pluginManager.withPlugin("com.android.library", action)
- project.pluginManager.withPlugin("org.jetbrains.kotlin.android") {
- project.extensions.getByType(KotlinTopLevelExtension::class.java).jvmToolchain(17)
- }
- project.pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
- project.extensions.getByType(KotlinTopLevelExtension::class.java).jvmToolchain(17)
- }
}
+ // We set kotlin.jvm.target.validation.mode=warning on the root projects, as for projects
+ // on Gradle 8+ and Kotlin 1.8+ this value is set to `error`. This will cause the build to
+ // fail if the JDK version between compileKotlin and compileJava and jvmTarget are not
+ // aligned. This won't be necessary anymore from React Native 0.73. More on this:
+ // https://kotlinlang.org/docs/whatsnew18.html#obligatory-check-for-jvm-targets-of-related-kotlin-and-java-compile-tasks
+ input.rootProject.extensions.extraProperties.set("kotlin.jvm.target.validation.mode", "warning")
}
} |
Hi! Despite @fadi-quader-mox solution works for me and it build everything correctly if you want to use react-navigation it works properly in the app module but the appInstant module will crash, i checked and it seems to be related to the navigation, e.g. I putted in App.tsx this code: Any suggestions to let it work? |
it's works for my project. |
Worth mentioning for those looking for a temporary solution: We had a scenario where we were managing a separate project that was using Gradle 8 and applying plugin |
Description
After I upgraded the react native to 0.73.0-rc.4 it started giving this error
Failed to apply plugin 'com.facebook.react'.> The value for property 'languageVersion' is final and cannot be changed any further.
React Native Version
0.73.0-rc.4
Output of
npx react-native info
System:
OS: macOS 14.1.1
CPU: (12) arm64 Apple M2 Max
Memory: 82.88 MB / 32.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.18.0
path: ~/.nvm/versions/node/v18.18.0/bin/node
Yarn:
version: 1.22.19
path: /opt/homebrew/bin/yarn
npm:
version: 9.8.1
path: ~/.nvm/versions/node/v18.18.0/bin/npm
Watchman:
version: 2023.10.02.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.13.0
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.0
- iOS 17.0
- macOS 14.0
- tvOS 17.0
- watchOS 10.0
Android SDK:
API Levels:
- "23"
- "29"
- "30"
- "31"
- "32"
- "33"
- "34"
Build Tools:
- 29.0.2
- 30.0.2
- 30.0.3
- 31.0.0
- 33.0.0
- 33.0.1
- 33.0.2
- 34.0.0
System Images:
- android-30 | Google APIs ARM 64 v8a
- android-31 | Google Play ARM 64 v8a
- android-32 | Automotive with Play Store ARM 64 v8a
- android-33-ext4 | Google Play ARM 64 v8a
- android-33 | Android Automotive with Google APIs ARM 64 v8a
- android-34 | Google APIs ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2022.3 AI-223.8836.35.2231.10811636
Xcode:
version: 15.0.1/15A507
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.9
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.73.0-rc.4
wanted: 0.73.0-rc.4
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
Steps to reproduce
fails at android sync
Snack, screenshot, or link to a repository
The text was updated successfully, but these errors were encountered: