Hi - on 1.6.0-RC I’m getting this build error. Any...
# eap
m
Hi - on 1.6.0-RC I’m getting this build error. Any ideas on how to resolve it? Thanks Unable to find method ‘’void org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions.setUseIR(boolean)‘’ ‘void org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions.setUseIR(boolean)’
d
Try to remove
useIr = true
(or
false
) from your build scripts
m
Yeah it's been removed and I get that error
If I don't remove it then there's a different error about useIr not supported
d
Can you show your
build.gradle.kts
?
m
Copy code
plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-kapt'
    id 'com.google.gms.google-services' // Must be before com.google.firebase.crashlytics
    id 'com.google.firebase.crashlytics'
    id 'dagger.hilt.android.plugin'
}

configurations {
    all {
        // Bug: xpp3 gradle build error
        // <https://stackoverflow.com/questions/48488563/gradle-xpp3-error>
        exclude group: 'xpp3', module: 'xpp3'

        // Bug: Duplicate class
        // <https://stackoverflow.com/questions/54717283/program-type-already-present-com-google-common-util-concurrent-listenablefuture>
        exclude group: 'com.google.guava', module: 'listenablefuture'

        exclude module: 'commons-logging'
        exclude module: 'httpclient'
    }
}

android {
    compileSdkVersion androidCompileSdkVersion
    bundle {
        density { enableSplit false }
        abi { enableSplit true }
        language { enableSplit false }
    }
    defaultConfig {
        applicationId androidApplicationId
        minSdkVersion androidMinimumSdkVersion
        targetSdkVersion androidTargetSdkVersion
        versionCode androidMobileVersionCode as Integer
        versionName androidMobileVersionName
        vectorDrawables { useSupportLibrary true }

        javaCompileOptions {
            annotationProcessorOptions {
                arguments += [
                        "room.incremental":"true"
                ]
            }
        }
    }
    compileOptions {
        sourceCompatibility rootProject.sourceCompatibility
        targetCompatibility rootProject.sourceCompatibility
    }
    kotlinOptions {
        jvmTarget = rootProject.sourceCompatibility
    }
    buildFeatures {
        viewBinding true
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion composeVersion
        kotlinCompilerVersion kotlinVersion
    }

    // BUG: Expected @HiltAndroidApp to have a value
    // <https://stackoverflow.com/questions/62887817/expected-hiltandroidapp-to-have-a-value-did-you-forget-to-apply-the-gradle-plu>
    kapt {
        javacOptions {
            // These options are normally set automatically via the Hilt Gradle plugin, but we
            // set them manually to workaround a bug in the Kotlin 1.5.20
            option("-Adagger.fastInit=ENABLED")
            option("-Adagger.hilt.android.internal.disableAndroidSuperclassValidation=true")
        }
    }
}

dependencies {
    implementation project(':kotlinShared')

    kapt "androidx.room:room-compiler:$roomVersion"

    // AndroidX
    // <https://developer.android.com/jetpack/androidx/versions>
    implementation "androidx.annotation:annotation:1.2.0"
    implementation "androidx.appcompat:appcompat:1.3.1"
    implementation 'androidx.biometric:biometric:1.1.0'
    implementation "androidx.browser:browser:1.3.0"
    implementation "androidx.cardview:cardview:1.0.0"
    implementation "androidx.core:core-ktx:1.6.0"
    implementation "androidx.activity:activity-ktx:1.3.1"
    implementation "androidx.fragment:fragment-ktx:1.3.6"
    implementation "androidx.lifecycle:lifecycle-common-java8:2.3.1"
    implementation "androidx.lifecycle:lifecycle-process:2.3.1"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
    implementation "androidx.preference:preference-ktx:1.1.1"
    implementation "androidx.recyclerview:recyclerview:1.2.1"
    implementation "androidx.room:room-ktx:$roomVersion"
    implementation "androidx.room:room-runtime:$roomVersion"
    implementation "androidx.work:work-runtime-ktx:2.5.0"
    implementation "androidx.work:work-rxjava3:2.5.0"

    // Compose
    implementation "androidx.activity:activity-compose:1.3.1"
    implementation "androidx.compose.material:material:$composeVersion"
    implementation "androidx.compose.ui:ui:$composeVersion"
    implementation "androidx.compose.ui:ui-tooling:$composeVersion"
    implementation "androidx.compose.ui:ui-tooling-preview:$composeVersion"
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"

    // Google APIs for Android
    // <https://developers.google.com/android/guides/releases>
    implementation 'com.google.android.gms:play-services-auth:19.2.0'
    api('com.google.apis:google-api-services-drive:v3-rev20200719-1.30.10') {
        exclude group: 'org.apache.httpcomponents'
    }

    // Admob
    // <https://developers.google.com/admob/android/rel-notes>
    implementation 'com.google.android.gms:play-services-ads:20.4.0'
    // UMP
    // <https://developers.google.com/admob/ump/android/quick-start>
    implementation 'com.google.android.ump:user-messaging-platform:2.0.0'

    // Firebase
    // <https://firebase.google.com/support/release-notes/android>
    // TODO: Use Firebase Android BoM
    //implementation platform('com.google.firebase:firebase-bom:27.0.0')
    implementation 'com.google.firebase:firebase-analytics-ktx:19.0.2'
    // TODO: Memory leak: <https://github.com/firebase/firebase-android-sdk/issues/2387>
    implementation 'com.google.firebase:firebase-auth-ktx:21.0.1'
    implementation 'com.google.firebase:firebase-config-ktx:21.0.1'
    implementation 'com.google.firebase:firebase-crashlytics-ktx:18.2.3'
    implementation 'com.google.firebase:firebase-firestore-ktx:23.0.4'
    implementation "com.google.firebase:firebase-messaging-ktx:22.0.0"

    // Using 1.32.2 due to AssertionError getAlpnSelectedProtocol
    // <https://github.com/firebase/firebase-android-sdk/issues/2642>
    implementation "io.grpc:grpc-okhttp:1.32.2"

    // Infra
    implementation 'com.jakewharton.timber:timber:4.7.1'
    implementation "com.squareup.retrofit2:adapter-rxjava3:$retrofitVersion"

    // <https://github.com/JakeWharton/RxRelay/releases>
    implementation "com.jakewharton.rxrelay3:rxrelay:$rxAndroidVersion"

    implementation "com.squareup.sqldelight:android-driver:$sqldelightVersion"
    implementation "com.squareup.sqldelight:android-paging-extensions:$sqldelightVersion"
    implementation "io.reactivex.rxjava3:rxandroid:$rxAndroidVersion"
    implementation "javax.annotation:javax.annotation-api:1.3.2"

    // UI
    implementation 'com.afollestad:sectioned-recyclerview:0.4.4'
    // <https://github.com/firebase/FirebaseUI-Android/releases>
    implementation 'com.firebaseui:firebase-ui-auth:7.1.1'
    implementation "com.mikepenz:fastadapter:$fastAdapterVersion"
    implementation "com.mikepenz:fastadapter-extensions-expandable:$fastAdapterVersion"
    implementation "com.mikepenz:fastadapter-extensions-binding:$fastAdapterVersion"
    implementation "com.mikepenz:fastadapter-extensions-diff:$fastAdapterVersion"
    implementation "com.mikepenz:fastadapter-extensions-drag:$fastAdapterVersion"
    implementation "com.mikepenz:fastadapter-extensions-paged:$fastAdapterVersion"
    implementation "com.mikepenz:fastadapter-extensions-scroll:$fastAdapterVersion"
    implementation "com.mikepenz:fastadapter-extensions-swipe:$fastAdapterVersion"
    implementation "com.mikepenz:fastadapter-extensions-ui:$fastAdapterVersion"
    implementation "com.mikepenz:fastadapter-extensions-utils:$fastAdapterVersion"

    // <https://github.com/square/picasso/releases>
    implementation 'com.squareup.picasso:picasso:2.8'

    // <https://github.com/grantland/android-autofittextview/releases/tag/0.2.1>
    implementation 'me.grantland:autofittextview:0.2.1'

    // <https://github.com/material-components/material-components-android/releases>
    implementation "com.google.android.material:material:1.4.0"

    // Dependency injection
    implementation("com.google.dagger:hilt-android:$hiltVersion")
    kapt("com.google.dagger:hilt-android-compiler:$hiltVersion")
}
Here’s the parent app build.gradle:
Copy code
ext {

    // Market share:
    // <https://developer.android.com/about/dashboards>
    // <https://source.android.com/setup/start/build-numbers>
    androidMinimumSdkVersion = 21
    // 31 is not compatible with androidx.work:work-rxjava3:2.5.0 - use 2.6.0+
    androidTargetSdkVersion = 30
    androidCompileSdkVersion = 30

    sourceCompatibility = JavaVersion.VERSION_11
    minifyEnabled = true

    versionCode = 1
    versionName = "1"

    documentationFolder = "${rootDir}/outputJavadoc/"
    availableProcessors = Runtime.runtime.availableProcessors()
}

buildscript {

    // Check for new updates:
    // Analyze > "Run Inspection By Name" > "Newer Library Versions Available"

    ext.annotationVersion = '1.2.0'
    ext.hiltVersion = '2.38.1'

    // <https://github.com/mikepenz/FastAdapter/releases>
    ext.fastAdapterVersion = '5.4.1'

    // <https://github.com/JetBrains/kotlin/releases>
    // <https://kotlinlang.org/docs/releases.html#release-details>
    ext.kotlinVersion = '1.6.0-RC'

    // <https://developer.android.google.cn/jetpack/androidx/releases/compose>
    ext.composeVersion = '1.0.4'

    ext.retrofitVersion = '2.9.0'
    ext.roomVersion = '2.2.6'

    // <https://github.com/ReactiveX/RxAndroid/releases>
    ext.rxAndroidVersion = '3.0.0'

    ext.sqldelightVersion = '1.5.1'

    // <https://github.com/square/leakcanary>
    ext.leakCanaryVersion = '2.7'

    ext.androidXTestRunnerVersion = '1.4.0'
    ext.espressoVersion = '3.4.0'
    ext.hamcrest = '2.2'
    ext.junitVersion = '4.13.2'
    ext.mockito = '3.9.0'
    ext.mockitoKotlin = '2.2.0'
    ext.powerMockVersion = '2.0.9'
    ext.roboElectric = '4.3.1'

    repositories {
        mavenCentral()
        maven { url '<https://oss.sonatype.org/content/repositories/snapshots/>' }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.3'

        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
        classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion"

        // <https://firebase.google.com/support/release-notes/android>
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
        classpath "com.google.gms:google-services:4.3.10"

        classpath "com.google.dagger:hilt-android-gradle-plugin:$hiltVersion"
    }
}
d
Maybe it's because of compose plugin? I'm not sure that it already supports 1.6
m
Compose 1.0.4 only supports 1.5.31, but it can be manually updated to allow compile against later version so not sure. Maybe some library is transitively setting setUseIR
Also this person on stackoverflow ran into same issue, and they downgraded to kotlin 1.5.31: https://stackoverflow.com/questions/69656802/unable-to-find-method-void-org-jetbrains-kotlin-gradle-dsl-kotlinjvmoptions-setu
But I want to use kotlin 1.6.0 for other reasons (the new memory model changes to native)
d
I can suggset only to play with RC in some toy project without lot of dependencies or wait till release, so all of them will upgrade to 1.6.0
👍 1
m
Kotlin 1.6 seems to fix this memory issue on iOS (causes device panic and reboot), so eagerly awaiting 1.6 stable: https://youtrack.jetbrains.com/issue/KT-47998
s
👍 1