Java version setting not being respected by the build

I am unable to set jvmTargets for Android. It is complaining that Calls to static methods in Java interfaces are prohibited in JVM target 1.6. Recompile with '-jvm-target 1.8'

I want to add kotlinOptions { jvmTarget = "1.8" } but I have been unable to.

I already have following compileOptiosns but isn’t enough.

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

Here are my two gradle files:

buildscript {
    ext {
        kotlin_version = '1.3.41'
        ktor_version = '1.2.2'
        gradle_version = '3.4.2'
    }

    repositories {
        google()
        jcenter()
        maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
    }
    dependencies {
        classpath "com.android.tools.build:gradle:$gradle_version"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
    }
}

plugins {
    id "com.android.library"
    id "org.jetbrains.kotlin.multiplatform"
    id "org.jetbrains.kotlin.android.extensions"
}

group = "com.testmpp.test"
version = 1.0


ext {
    kotlinx_coroutine_version = "1.3.0-M2"
    kotlinx_io_version = "0.1.11"
}

android {
    compileSdkVersion 28
    defaultConfig {
        minSdkVersion 24
        targetSdkVersion 28
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    packagingOptions {
        exclude "META-INF/*.kotlin_module"
    }

}

kotlin {
    targets {
        fromPreset(presets.android, "androidLib") {
        }

        def buildForDevice = project.findProperty("device")?.toBoolean() ?: false
        def iosPreset = (buildForDevice) ? presets.iosArm64 : presets.iosX64
        fromPreset(iosPreset, "ios") {
            binaries {
                framework {
                    // Disable bitcode embedding for the simulator build.
                    if (!buildForDevice) {
                        embedBitcode("disable")
                    }
                }
            }
        }
    }

    sourceSets {
        commonMain {
            dependencies {
                implementation "org.jetbrains.kotlin:kotlin-stdlib-common"
                implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinx_coroutine_version"
                implementation "org.jetbrains.kotlinx:kotlinx-io:$kotlinx_io_version"

                implementation "io.ktor:ktor-client-core:$ktor_version"
                implementation "io.ktor:ktor-client-gson:$ktor_version"
                implementation "io.ktor:ktor-client-apache:$ktor_version"
                implementation "io.ktor:ktor-client-json:$ktor_version"


            }
        }
        commonTest {
            dependencies {
                implementation "org.jetbrains.kotlin:kotlin-test-common"
                implementation "org.jetbrains.kotlin:kotlin-test-annotations-common"
            }
        }

        androidLibMain {
            dependencies {
                // Specify Kotlin/JVM stdlib dependency.
                implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
                implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0-M2"
                implementation "org.jetbrains.kotlinx:kotlinx-io-jvm:$kotlinx_io_version"

                implementation "io.ktor:ktor-client-android:$ktor_version"

                implementation 'software.amazon.awssdk:dynamodb'
                implementation 'software.amazon.awssdk:url-connection-client'
            }
        }

        iosMain {
            dependencies {
                implementation "org.jetbrains.kotlinx:kotlinx-io-native:$kotlinx_io_version"
                implementation "io.ktor:ktor-client-ios:$ktor_version"

            }
        }

    }
}


dependencies {
    implementation platform('software.amazon.awssdk:bom:2.5.29')

    testImplementation "junit:junit:4.12"
    testImplementation "org.jetbrains.kotlin:kotlin-test"
    testImplementation "org.jetbrains.kotlin:kotlin-test-junit"

    androidTestImplementation "junit:junit:4.12"
    androidTestImplementation "org.jetbrains.kotlin:kotlin-test"
    androidTestImplementation "org.jetbrains.kotlin:kotlin-test-junit"

    androidTestImplementation "androidx.test:runner:1.1.0"
    androidTestImplementation "androidx.test.espresso:espresso-core:3.1.0"
}

task copyFramework {
    def buildType = project.findProperty("kotlin.build.type") ?: "DEBUG"
    dependsOn "link${buildType.toLowerCase().capitalize()}FrameworkIos"

    doLast {
        def srcFile = kotlin.targets.ios.binaries.getFramework(buildType).outputFile
        def targetDir = getProperty("configuration.build.dir")
        copy {
            from srcFile.parent
            into targetDir
            include “TestMPP.framework/**"
            include “TestMPP.framework.dSYM"
        }
    }
}

task iosTest {
    def device = project.findProperty("iosDevice")?.toString() ?: "iPhone 8"
    dependsOn "linkDebugTestIos"
    group = JavaBasePlugin.VERIFICATION_GROUP
    description = "Runs tests for target 'ios' on an iOS simulator"

    doLast {
        def binary = kotlin.targets.ios.binaries.getTest("DEBUG").outputFile
        exec {
            commandLine "xcrun", "simctl", "spawn", device, binary.absolutePath
        }
    }
}