Kotlin OpenCV4.7 Integration Error

Hi there,
I’m new to OpenCV and I’m trying to integrate it to my new Android Project. I was able to import the SDK as a module, but when I added it as a dependency to the app module I got this error:

Execution failed for task ':opencv:compileDebugKotlin'.
> 'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
  Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain

I tried to resolve it on my own with no success. Please somebody help me as I’m running to meet a deadline.

I’m using Android Studio Flamingo and building with gradle-8.0.

Thank you

2 Likes

I have the same issue, I tried all the stackoverflow similar questions but no luck, just bumping the questions to see if there’s a samaritan that knows how to fix this.

I think it’d be a good idea to find out which versions are involved, and how to control them to be the same.

I have the same problem with OpenCV4.10. Anybody fixed this?

Please check kotlin - How to set compileJava' task ( 11) and 'compileKotlin' task (1.8) jvm target compatibility to the same Java version in build.gradle.kts? - Stack Overflow & see if it helps.

    kotlinOptions {
        jvmTarget=11
    }

was missing in opencv:build.gradle

1 Like