przelewy24 / p24-mobile-lib-flutter

Other
11 stars 1 forks source link

Execution failed for task ':p24_sdk:compileDebugKotlin'. #22

Open maciogg opened 1 week ago

maciogg commented 1 week ago

Have error

⁠'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.

mareklat commented 1 week ago

But java target should be set in your project. The mentioned settings are not from the library

maciogg commented 1 week ago

Have config

gradle-wrapper.properties distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip

settings.gradle id "com.android.application" version '8.3.0' apply false id "org.jetbrains.kotlin.android" version "2.0.21" apply false

build.gradle (app) compileOptions { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 coreLibraryDesugaringEnabled = true

}

kotlinOptions { jvmTarget = "17"
}

On other project with:

gradle-7.5-all.zip and id "com.android.application" version "7.3.0" apply false

compileOptions {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
    jvmTarget = '1.8'
}

working fine

maciogg commented 3 days ago

Any update?

With gradle-7.5-all.zip and id "com.android.application" version "7.3.0" apply false

and

compileOptions { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 coreLibraryDesugaringEnabled = true

}

kotlinOptions { jvmTarget = "17" }

it also works

radeckid commented 1 day ago

For me, this worked when i added the following to the android/build.gradle file inside the allprojects block:

    subprojects {
        afterEvaluate { project ->
            if (project.hasProperty('android')) {
                project.android {
                    if (project.name == "p24_sdk") {
                        namespace project.group
                        def javaVersion = JavaVersion.VERSION_1_8
                        project.android.compileOptions {
                            sourceCompatibility javaVersion
                            sourceCompatibility javaVersion
                        }
                        project.android.kotlinOptions {
                            jvmTarget = javaVersion.toString()
                        }
                    }
                }
            }
        }
    }
maciogg commented 1 day ago

For me, this worked when i added the following to the android/build.gradle file inside the allprojects block:

    subprojects {
        afterEvaluate { project ->
            if (project.hasProperty('android')) {
                project.android {
                    if (project.name == "p24_sdk") {
                        namespace project.group
                        def javaVersion = JavaVersion.VERSION_1_8
                        project.android.compileOptions {
                            sourceCompatibility javaVersion
                            sourceCompatibility javaVersion
                        }
                        project.android.kotlinOptions {
                            jvmTarget = javaVersion.toString()
                        }
                    }
                }
            }
        }
    }

Dzięki :)