react-native-vision-camera: 🐛 Task :react-native-vision-camera:compileDebugKotlin FAILED

What were you trying to do?

I am trying to install this library

Reproduceable Code

No response

What happened instead?

Build fails at this step: > Task :react-native-vision-camera:compileDebugKotlin FAILED

Relevant log output

> Task :react-native-vision-camera:compileDebugKotlin FAILED
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
    user/.gradle/caches/transforms-2/files-2.1/664f78d5defbcdceed6cc6b91334957c/jetified-kotlin-stdlib-jdk8-1.5.30.jar (version 1.5)
    user/.gradle/caches/transforms-2/files-2.1/98f292b47b7ae2a67fdb09d889c153dc/jetified-kotlin-stdlib-jdk7-1.5.30.jar (version 1.5)
    user/.gradle/caches/transforms-2/files-2.1/2482ed84b3d2e1c78620a60749fa204b/jetified-kotlin-stdlib-1.6.10.jar (version 1.6)     
    user/.gradle/caches/transforms-2/files-2.1/a1dc49042920562f5109600bb5b5b2b0/jetified-kotlin-stdlib-common-1.6.10.jar (version 1.6)     
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings
581 actionable tasks: 8 executed, 573 up-to-date
e: \node_modules\react-native-vision-camera\android\src\main\java\com\mrousavy\camera\frameprocessor\FrameProcessorRuntimeManager.kt: (65, 76): Unresolved reference: resolveView

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-vision-camera:compileDebugKotlin'.
> Compilation error. See log for more details

* 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

Device

Xiaomi mi A2 lite (real device)

VisionCamera Version

2.13.2

Additional information

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 42 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Same problem. Have any suggestions??

In my case below solutions is working…

  1. Remove all node files
  2. npm i
  3. Try to install with particular version like… npm i react-native-vision-camera@2.13.0

For me downgrading Kotlin worked well

Just change the kotlinVersion in android/build.gradle to 1.7.21 (I didn’t check other versions):

buildscript {
  ext {
    ...
    kotlinVersion = '1.7.21'
    ...
  }
  ...
}

Just delete node_modules, edit lib version in package.json to 2.13.0, run yarn or npm, run gradlew clean and thats it

The downgrade did not work here.

“react-native”: “0.63.2” “react-native-vision-camera”: “2.13.0”

I found a solution. resolveView method was inserted at RN 0.66.

minor RN can’t use latest vision camera.

To fix this. open FrameProcessorRuntimeManger.kt and edit

val view: CameraView? = ctx?.currentActivity?.findViewById<CameraView>(viewId)
//    val view = if (ctx != null) UIManagerHelper.getUIManager(ctx, viewId)?.resolveView(viewId) as CameraView? else null

open CameraViewModule.kt and edit

val view: CameraView? = ctx?.currentActivity?.findViewById<CameraView>(viewId)
//    val view = if (ctx != null) UIManagerHelper.getUIManager(ctx, viewId)?.resolveView(viewId) as CameraView? else null

I can’t use 0.66, my project use 0.64

Ah my bad I just didn’t see the error correctly. You’re right, this is available only on newer RN versions

Any updates on this? In the sense that the current expo sdk and react native version will support react-native-vision-camera properly? expo: 49.0.5 react-native: 0.72.3 react-native-vision-camera: 2.15.4

Downgrading to 2.13.0 fixed it for me. I don’t know why.

If it is related to the RN version, I think it should be mentioned in the docs

I am using RN 0.64.1

 "react": "17.0.2",
"react-native": "^0.64.2",

gradle version: 
com.android.tools.build:gradle:4.2.0
gradle-6.7.1

“react-native-vision-camera”: “2.13.0”

cleared node modules and package-lock.json ran this command in terminal : npm i; cd android ; ./gradlew clean; cd …

This worked

The downgrade did not work here.

“react-native”: “0.63.2” “react-native-vision-camera”: “2.13.0”

Same here… Downgrade is also not working for me. I had installed version “2.11.2” After changing and tried with version “2.13.2”, “2.13.1” & “2.13.2” facing above error.

And even after changed to old version i.e. “2.11.2”, node_modules packages are updated so that error show continue while building Android code.

This might be related to #957.

Downgrading to 2.13.0 fixed it for me. I don’t know why.

If it is related to the RN version, I think it should be mentioned in the docs

I am using RN 0.64.1

image

how is this only warning