react-native-gesture-handler
react-native-gesture-handler copied to clipboard
[Android] The Kotlin Gradle plugin was loaded multiple times in different subprojects
Description
Every time when I building my project, the following warning appears in the gradle output. I don't think this a problem (the project build correctly), but decided to inform about it.
My environment:
gradle 7.5.1 gradle plugin: 7.2.2
Steps to reproduce
Start build the RN project -> the following warning appears in the gradle output:
The Kotlin Gradle plugin was loaded multiple times in different subprojects, which is not supported and may break the build. This might happen in subprojects that apply the Kotlin plugins with the Gradle 'plugins { ... }' DSL if they specify explicit versions, even if the versions are equal. Please add the Kotlin plugin to the common parent project or the root project, then remove the versions in the subprojects. If the parent project does not need the plugin, add 'apply false' to the plugin line. See: https://docs.gradle.org/current/userguide/plugins.html#sec:subprojects_plugins_dsl The Kotlin plugin was loaded in the following projects: ':react-native-gesture-handler', ':react-native-screens'
Snack or a link to a repository
none
Gesture Handler version
2.8.0
React Native version
0.70.4
Platforms
Android
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Paper (Old Architecture)
Build type
Release mode
Device
Real device
Device model
No response
Acknowledgements
Yes
Hey! 👋
The issue doesn't seem to contain a minimal reproduction.
Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?
+1 seeing the same issue
@SaraChicaD no, this issue is not related to something like that. The gradle log shows modules that are involved in the issue:
The Kotlin plugin was loaded in the following projects: ':react-native-gesture-handler', ':react-native-screens'
+1 same issue..
+1 Same issue The Kotlin plugin was loaded in the following projects: ':react-native-gesture-handler', ':react-native-screens'
any updates?
+1 also getting this same error: The Kotlin plugin was loaded in the following projects: ':react-native-gesture-handler', ':rnmapbox_maps'
FWIW I have (temporarily?) resolved this issue by adding kotlinVersion=1.8.0
to my gradle.properties
file
(I was having version issues between jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0)
and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
)
Update:
I tested the fix suggested here.
Which is to add implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
to the app/build.gradle
file.
This also results in a successful build..
I also got this issue: The Kotlin plugin was loaded in the following projects: ':react-native-gesture-handler', ':react-native-screens'
in my case, i forgot to put Gradle variables into android/gradle.properties.
so just put the Gradle variables into android/gradle.properties.
this is the Gradle variables look like: https://reactnative.dev/docs/signed-apk-android#setting-up-gradle-variables
MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore MYAPP_UPLOAD_KEY_ALIAS=my-key-alias MYAPP_UPLOAD_STORE_PASSWORD=***** MYAPP_UPLOAD_KEY_PASSWORD=*****
Adding implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
to the app/build.gradle file not working for me. Any updates?
Any Solution ??
+1 same problem
+1 Facing same problem
+1
Same here with reanimated
+1
facing this issue too
Idem +1
I set version to 2.9.1
and then the app successfully built, however, it kept crashing... iOS no such problem.
+1
Estou com o mesmo problema ainda ao tentar executar meu aplicativo
+1 Also facing the same problem here, with reanimated
I believe this could be resolved by making the following modifications to the build.gradle file:
buildscript {
// Define Kotlin Version from parent project - Buildscript is evaluated before everything else so we can't use getExtOrDefault
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["Misnap_kotlinVersion"]
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.2.1"
// noinspection DifferentKotlinGradleVersion
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
And then for dependencies:
def kotlin_version = getExtOrDefault("kotlinVersion")
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
+1 I am also facing the same problem, but we are able to run it on a different computer. We have checked various settings on Android Studio's side, and everything appears to be the same.
any updates? does anyone here have a solution?
Solution Update:
I'm pleased to share that I've managed to resolve this issue by adding the following line to the dependencies
section within the app/build.gradle
file:
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0")
This addition successfully addressed the problem I was encountering.
I just created a new project using expo, and run it. I have touched nothing:
The Kotlin Gradle plugin was loaded multiple times in different subprojects, which is not supported and may break the build. This might happen in subprojects that apply the Kotlin plugins with the Gradle 'plugins { ... }' DSL if they specify explicit versions, even if the versions are equal. Please add the Kotlin plugin to the common parent project or the root project, then remove the versions in the subprojects. If the parent project does not need the plugin, add 'apply false' to the plugin line. See: https://docs.gradle.org/current/userguide/plugins.html#sec:subprojects_plugins_dsl The Kotlin plugin was loaded in the following projects: ':expo', ':expo-modules-core'
I did something that works.
go android/app/build.gradle
and check
namespace
and applicationId
Those where created using "com.appname", but when I started my expo project I specified "com.company.appname"
I'm having the same error but this doesn't seem to solve my issue...
I'm having the same error but this doesn't seem to solve my issue...
for my current project using prebuild I run yarn cache clean && yarn
after success npx expo prebuild
i'm not sure if you all work with my solution