Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

> Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (21) and 'compileDebugKotlin' (17). #150

Open
hemal08ce094 opened this issue Jun 19, 2024 · 4 comments

Comments

@hemal08ce094
Copy link

Hello Team,

i am trying hello world app with Skip. i m stuck on the build script for android it throws this error.

Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (21) and 'compileDebugKotlin' (17).

Screenshot 2024-06-19 at 10 16 54 PM Screenshot 2024-06-19 at 10 18 25 PM

Attached is Error I get and build script file for android. i have android studio installed on my Mac M1 Pro machine. there is no modification done from my side. This is just a Hello World app. Check goes through fine. i don't get any error on that part.

@marcprux
Copy link
Contributor

Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (21) and 'compileDebugKotlin' (17).

I think that might be a red herring. Since skip checkup passed for you, your system should have the correct JVM installed.

The other error message in the log might be the more salient one:

No connected Android devices or emulators were reported by 'adb devices'. To launch the Skip app, start an emulator from the Android Studio Device Manager or use the ~/Library/Android/sdk/emulator/emulator command

Have you launched an Android emulator, as per https://skip.tools/docs/app-development/#building-and-running ? If not, can you do so and then try again, and let us know if you still get errors?

@hemal08ce094
Copy link
Author

Tried by keeping android emulator open. it throws same error. tried setting path for java home to 17, but not sure from where its picking up 21.
Screenshot 2024-06-20 at 8 21 58 AM

@aabewhite
Copy link
Contributor

So "skip checkup" passes? Do you have JAVA_HOME set in your environment? What does the following Terminal command output?

echo $JAVA_HOME

@marcprux
Copy link
Contributor

Can you try editing the Android/app/build.gradle.kts file in Xcode and adding the following clause to the android { } block:

    kotlinOptions {
        jvmTarget = libs.versions.jvm.get().toString()
    }

So, for example, it looks like this:

android {
    namespace = group as String
    compileSdk = libs.versions.android.sdk.compile.get().toInt()
    compileOptions {
        sourceCompatibility = JavaVersion.toVersion(libs.versions.jvm.get())
        targetCompatibility = JavaVersion.toVersion(libs.versions.jvm.get())
    }
    kotlinOptions {
        jvmTarget = libs.versions.jvm.get().toString()
    }

and then try running the project again? That may be all it it needs to force it to use the correct JVM target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants