‘The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.40 and higher’ React Native Error Fix
I was working on a react native project where I installed watermelonDB for storage purposes. After the installation, I could not run the project on Android emulator because of the following error.
The error was related to Kotlin Gradle Plugin.
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.40 and higher.
The following dependencies do not satisfy the required version:
project ':nozbe_watermelondb' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.21
The same issue was raised by someone else on Github and there I found the solution.
Go to YourProject/android/build.gradle file and add the following two lines to ext {} tag.
kotlin_version = '1.5.20'
kotlinVersion = '1.5.20'
By adding these two lines, the ext tag will now look as follows.
ext {
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"
}
kotlin_version = '1.5.20'
kotlinVersion = '1.5.20'
}
Rebuild your project and now, you can run it without errors.
The React Native version I used here for demonstration is 0.70.0.