Skip to content

Error: plugin already on the classpath must not include a version #34229

@erennyuksell

Description

@erennyuksell

Description

When i run npx react-native run-android command i get below error. I'am using React-Native-Navigation library by wix and
android/build.gradle
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
inside node_modules/react-native/ReactAndroid/build.gradle are conflict
id("org.jetbrains.kotlin.android") version "1.6.10"

Since this issue relevant with RNN i'am taging you @guyca

warn Package react-native-navigation contains invalid configuration: "dependency.assets" is not allowed,"dependency.hooks" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1708 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...

> Configure project :app
WARNING:The option setting 'android.enableDexingArtifactTransform.desugaring=false' is experimental.
The current default is 'true'.

> Configure project :react-native-reanimated
AAR for react-native-reanimated has been found
/Users/**/Desktop/***-mobile/node_modules/react-native-reanimated/android/react-native-reanimated-69-hermes.aar

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
6 actionable tasks: 6 up-to-date

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/***/Desktop/***-mobile/node_modules/react-native/ReactAndroid/build.gradle' line: 11

* What went wrong:
Error resolving plugin [id: 'org.jetbrains.kotlin.android', version: '1.6.10']
> Plugin request for plugin already on the classpath must not include a version

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 47s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/***/Desktop/***-mobile/node_modules/react-native/ReactAndroid/build.gradle' line: 11

* What went wrong:
Error resolving plugin [id: 'org.jetbrains.kotlin.android', version: '1.6.10']
> Plugin request for plugin already on the classpath must not include a version

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 47s

    at makeError (/Users/***/Desktop/***-mobile/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
    at /Users/***/Desktop/***-mobile/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (/Users/***/Desktop/****-mobile/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
    at async Command.handleAction (/Users/**/Desktop/****-mobile/node_modules/@react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.

Version

0.69.1

Output of npx react-native info

System:
OS: macOS 12.4
CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
Memory: 228.88 MB / 8.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
Yarn: Not Found
npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm
Watchman: 2021.06.07.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8609683
Xcode: 13.4/13F17a - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.69.1 => 0.69.1
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

Follow react native navigation installation guide and enable new architecture then run-android

Snack, code example, screenshot, or link to a repository

import org.apache.tools.ant.taskdefs.condition.Os

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext {
kotlinVersion = '1.6.10'
RNNKotlinVersion = kotlinVersion
detoxKotlinVersion = kotlinVersion
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31

    if (System.properties['os.arch'] == "aarch64") {
        // For M1 Users we need to use the NDK 24 which added support for aarch64
        ndkVersion = "24.0.8215888"
    } else {
        // Otherwise we default to the side-by-side NDK version from AGP.
        ndkVersion = "21.4.7075529"
    }
}
repositories {
    google()
    mavenCentral()
}
dependencies {
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    classpath("com.android.tools.build:gradle:7.1.1")
    classpath("com.facebook.react:react-native-gradle-plugin")
    classpath("de.undercouch:gradle-download-task:5.0.1")
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }
}
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions