I am facing issues while using the react-native-vision-camera package for a small camera app. I encountered an error while building the app on Android which says "The Android Gradle plugin supports only kotlin-android-extensions Gradle plugin version 1.6.20 and higher.The following dependencies do not satisfy the required version: project ':react-native-vision-camera' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30
and its failing my built on android."
I tried adding "kotlinVersion = "1.7.0"
(under buildToolsVersion) to the android/build.gradle
file but it gave me another error "Error: EPERM: operation not permitted."
Running the commands as an administrator also did not work. I am using a Windows 10 machine with the latest version of Node.js and React Native.
Has anyone successfully set up the react-native-vision-camera package? I have followed the documentation but still facing these issues. It would be great if anyone could help me fix these errors and provide proper setup instructions.
2
Answers
To solve this issue, you can try upgrading the Kotlin Gradle plugin version in the react-native-vision-camera project to version 1.6.20 or higher, which is supported by the Android Gradle plugin version you are using.
Go to node_modules/react-native-vision-camera/android/build.gradle
inside dependencies
remove classpath “org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version”
add classpath “org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.20”
There is no need to change anything in node_modules (this is not very good). It’s simple enough in your android/build.gradle add
inside buildscript->ext