mrousavy / react-native-vision-camera

📸 A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
6.72k stars 1k forks source link

🐛 Support for kotlin-android-extensions Gradle plugin version 1.6.20 and higher. #1352

Closed maddeye closed 9 months ago

maddeye commented 1 year ago

What were you trying to do?

Run my demo application

Reproduceable Code

Use a blank react native init project with gradle 8

What happened instead?

Build Process crashes.

Relevant log output

FAILURE: Build failed with an exception.

* What went wrong:
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

Device

Android Simulator

VisionCamera Version

2.15.2

Additional information

finger-guns commented 1 year ago

any updates on this one?

maddeye commented 1 year ago

Not really. I found, that Gradle 7.3.3 and Gradle Plugin 7.2.2 is the sweetspot to get everything running and use the current react. You can set this in Android Studio -> Open Module Settings -> Project. Hope this helps!

sleaper commented 1 year ago

Having the same error.

shohelahamad commented 1 year ago

any update on that ? I am having the same error.

sleaper commented 1 year ago

any update on that ? I am having the same error.

I added kotlinVersion = "1.7.0" (under buildToolsVersion) to android/build.gradle and error disappeared.

bilal-korir commented 1 year ago

any update on that ? I am having the same error.

I added kotlinVersion = "1.7.0" (under buildToolsVersion) to android/build.gradle and error disappeared.

Thank you @sleaper that solves the issue on my side.

betanyeli commented 1 year ago

any update on that ? I am having the same error.

I added kotlinVersion = "1.7.0" (under buildToolsVersion) to android/build.gradle and error disappeared.

Gracias buen hombre 👨‍💻 ! ✨ funcionó perfecto

GerardoTovar commented 1 year ago

any update on that ? I am having the same error.

I added kotlinVersion = "1.7.0" (under buildToolsVersion) to android/build.gradle and error disappeared.

Muchas Gracias bro. El problema se resolvió @sleaper

wmeints commented 1 year ago

Adding kotlinVersion =1.7.0 to my android/gradle.properties file in my project fixed it for me.

imran1992 commented 1 year ago

Adding kotlinVersion =1.7.0 to my android/gradle.properties file in my project fixed it for me.

By android/gradle.properties do you mean android/build.gradle

DevineDecrypter commented 1 year ago

issue still persists on react-native@0.71.3

edritech93 commented 1 year ago

still issue on react-native 0.71.7

mkultr4 commented 1 year ago

still issue on react-native@0.71.7

waleedshkt commented 1 year ago

Follow this instruction, and it's working on RN 0.71.8

any update on that ? I am having the same error.

I added kotlinVersion = "1.7.0" (under buildToolsVersion) to android/build.gradle and error disappeared.

jonxssc commented 1 year ago

Bug is still there, i have a temporary fix for everyone who faces this error: go to react-native-vision-camera in the node-modules folder. There go to android/build.gradle and search for this line org.jetbrains.kotlin:kotlin-gradle-plugin, change it to: org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.20 save, then run cd android && ./gradlew clean and then restart your App, works for me, i hope this bug gets fixed soon

Jhon-Idrovo commented 1 year ago

This is stopping me from using this in production. Please fix it @mrousavy

sergioprz commented 1 year ago

Has anyone gotten it to work with rn 0.70.8?

jonxssc commented 1 year ago

Has anyone gotten it to work with rn 0.70.8?

Yes, try my answer two messages above

batgerelt commented 1 year ago

Bug is still there, i have a temporary fix for everyone who faces this error: go to react-native-vision-camera in the node-modules folder. There go to android/build.gradle and search for this line org.jetbrains.kotlin:kotlin-gradle-plugin, change it to: org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.20 save, then run cd android && ./gradlew clean and then restart your App, works for me, i hope this bug gets fixed soon

Worked for me Thank you :-)

mrousavy commented 1 year ago

That's because RN upgrades (or other libs that use Kotlin) break the version. There's not a lot I can do about this apart from just updating Kotlin version everytime.

thegreatzeus commented 12 months ago

@mrousavy Please upgrade the version because only you can update the npm package. I would have to manually make changes to the library folder in node_modules every time I want to build locally and if I want to use EAS build I can't even do that.

Please push this change. Thank you!

bosz commented 11 months ago

ndroid/gradle.properties

Thanks bro, life saver.

Jhon-Idrovo commented 11 months ago

For those using expo you can install a config plugin: https://docs.expo.dev/versions/latest/sdk/build-properties/

and in your app.json

"expo":
 "plugins": [
      [
        "expo-build-properties",
        {
          "android": {
            "kotlinVersion": "1.7.0"
          }
        }
      ]
    ]
Ali-Kheiri commented 11 months ago

any update on that ? I am having the same error.

I added kotlinVersion = "1.7.0" (under buildToolsVersion) to android/build.gradle and error disappeared.

@sleaper thanks!

mianaamirshehzad commented 11 months ago

any update on that ? I am having the same error.

I added kotlinVersion = "1.7.0" (under buildToolsVersion) to android/build.gradle and error disappeared.

Thank you so much for giving the solution. It has reduced my efforts.

mianaamirshehzad commented 11 months ago

any update on that ? I am having the same error.

I added kotlinVersion = "1.7.0" (under buildToolsVersion) to android/build.gradle and error disappeared.

Thank you so much for giving the solution. It has reduced my efforts.

My previous error is eliminated but now my screen turns blank when I start the camera. Any fix for it.?

erikemg commented 9 months ago

I tried the method you provided but my apk just crashes as soon as I open it. Is there a way to fix this?

istashak commented 9 months ago

I've literally tried every suggested fix on this thread, and none of them have worked. I can't get past a gradle sync.

mrousavy commented 9 months ago

Hey! I've rewritten the entire Android codebase of VisionCamera from CameraX to Camera2 in the efforts of ✨ VisionCamera V3.

I just now completed the Camera2 rewrite and I believe the core structure is running, but there might be some edge cases to iron out. Can you try and test the PR #1674 for me to see if you can still reproduce this issue here?

Here's an instruction on how you can test that: https://github.com/mrousavy/react-native-vision-camera/pull/1674#issuecomment-1684104217

If the issue cannot be reproduced with that version/PR anymore, then hoorayy, I fixed it! 🎉 Otherwise please let me know and I'll keep this issue open to keep track of it.

Thank you!

ohheyitskartik commented 9 months ago

@mrousavy Please upgrade the version because only you can update the npm package. I would have to manually make changes to the library folder in node_modules every time I want to build locally and if I want to use EAS build I can't even do that.

Please push this change. Thank you!

use npm patch-package to patch it on your end with your changes so it applies changes on every npm install until the new version comes out

edit : i checked the files, it picks your kotlin version from your android/build.gradle but only if you have it defined there and the name matches "kotlinVersion" make sure you have it in your ext config and the name matches, i was using "kotlin_version" as kotlin version variable which caused the issue.

matiasgdev commented 9 months ago

@mrousavy Please upgrade the version because only you can update the npm package. I would have to manually make changes to the library folder in node_modules every time I want to build locally and if I want to use EAS build I can't even do that. Please push this change. Thank you!

use npm patch-package to patch it on your end with your changes so it applies changes on every npm install until the new version comes out

edit : i checked the files, it picks your kotlin version from your android/build.gradle but only if you have it defined there and the name matches "kotlinVersion" make sure you have it in your ext config and the name matches, i was using "kotlin_version" as kotlin version variable which caused the issue.

This is the true answer, thank you so much!

Hakimji-Mustafa commented 9 months ago

Adding kotlinVersion =1.7.0 to my android/gradle.properties file in my project fixed it for me.

akash510 commented 8 months ago

Hi, i already change the kotlin version to 1.7.0 FAILURE: Build failed with an exception. But, still showing same error. Please help. Error

my code: buildscript { ext.kotlin_version = '1.7.0' repositories { google() mavenCentral()

}

dependencies {
    classpath 'com.android.tools.build:gradle:7.3.0'
    classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0'
    classpath 'com.google.gms:google-services:4.3.15'
}
mahammad72 commented 4 months ago

any update on that ? I am having the same error.

I added kotlinVersion = "1.7.0" (under buildToolsVersion) to android/build.gradle and error disappeared.

Thanks man you save my time