Dolphin IDE: This version (1.2.0-alpha05) of the Compose Compiler requires Kotlin version 1.6.10 but you appear to be using Kotlin version 1.6.21

Viewed 58

The error goes on to say "Please fix your configuration (or suppressKotlinVersionCompatibilityCheck but don't say I didn't warn you!)."

It is not obvious to me how to "fix" the configuration. I added the suggested flag, but it does not resolve and fails on its own.

The IDE is Dolphin Android Studio Dolphin | 2021.3.1

The project sets the Kotlin version:

buildscript {
    ext.kotlin_version = '1.6.10'

I previously set the project to use Kotlin 1.7.10 here, but downgraded in the vain hope it would solve the issue, but it does not.

I tried adding an explicit dependency on androidx.compose.compiler:compiler which appears to be silently ignored.

I do not see where Kotlin 1.6.21 and Compose Compiler 1.2.0-alpha05 are being set, as neither is set in the build files.

I'm familiar with Android, but not Compose. I am using the current stable IDE and dependency statements taken directly from the Compose documentation, and yet the project fails to build.

I suspect there is some magic combination of dependency versions needed to use Compose in Dolphin, but I have not been able to find it.

I tried Compose at v1.0 but had to back out again as there were so many issues, and it seems it is still challenging to work with, but perhaps some kind soul will point out my error and then I will happily apologise to our friends at Google. :-)

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'androidx.navigation.safeargs'
apply plugin: 'com.google.firebase.crashlytics'

android {

    namespace "com.blah"
    
    compileSdk 33

    defaultConfig {
        applicationId "com.blah"
        minSdk 21
        targetSdk 33
        versionCode 123
        versionName "1.2.3"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    flavorDimensions "environment"
    productFlavors {
        staging {
            dimension "environment"
            applicationIdSuffix ".staging"
        }
        production {
            dimension "environment"
        }
    }

    applicationVariants.all { variant ->
        variant.outputs.all { output ->
            outputFileName = "MyApp-${variant.versionName}-${variant.name}.apk"
        }
    }

    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
        }
    }

    buildFeatures {
        dataBinding true
        compose true
    }

    lint {
        disable 'RtlHardcoded'
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    // Coroutines
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.2'

    // Android X Jetpack
    implementation "androidx.appcompat:appcompat:1.5.1"
    implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
    implementation 'androidx.core:core-ktx:1.9.0'
    implementation "androidx.constraintlayout:constraintlayout:2.1.4"
    implementation "androidx.recyclerview:recyclerview:1.2.1"
    implementation "androidx.fragment:fragment-ktx:1.5.2"
    implementation "androidx.collection:collection-ktx:1.2.0"
    implementation "androidx.window:window:1.0.0"

    // Jetpack Compose
    implementation("androidx.compose.ui:ui:1.2.1")
    implementation("androidx.compose.ui:ui-tooling:1.2.1")
    // Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
    implementation("androidx.compose.foundation:foundation:1.2.1")
    implementation("androidx.compose.material:material:1.2.1")
    implementation("androidx.compose.material:material-icons-core:1.2.1")
    implementation("androidx.compose.material:material-icons-extended:1.2.1")
    // Integration with observables
    implementation("androidx.compose.runtime:runtime-livedata:1.2.1")
    implementation("androidx.compose.runtime:runtime-rxjava2:1.2.1")

    // Google
    implementation "com.google.android.material:material:1.6.1"
    implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'

    // Navigation Component
    implementation "androidx.navigation:navigation-fragment-ktx:2.5.2"
    implementation "androidx.navigation:navigation-ui-ktx:2.5.2"

    // Firebase & Crashlytics
    implementation "com.google.firebase:firebase-core:21.1.1"
    implementation "com.google.firebase:firebase-analytics:21.1.1"
    implementation "com.google.firebase:firebase-crashlytics:18.2.13"
    implementation "com.google.firebase:firebase-messaging:21.0.1"

    // Urban Airship push messaging
    implementation "com.urbanairship.android:urbanairship-fcm:13.3.5"

    // Twilio (video calling)
    implementation "com.twilio:video-android-ktx:7.1.1"
    implementation "com.twilio:audioswitch:1.1.4"

    // ExoPlayer
    implementation "com.google.android.exoplayer:exoplayer-core:2.18.1"
    implementation "com.google.android.exoplayer:exoplayer-ui:2.18.1"

    // Third-party
    implementation "com.jakewharton.timber:timber:5.0.1"
    implementation "com.jakewharton.threetenabp:threetenabp:1.4.0"
    implementation "com.squareup.retrofit2:retrofit:2.9.0"
    implementation "com.squareup.retrofit2:converter-moshi:2.9.0"
    implementation "com.squareup.picasso:picasso:2.71828"
    implementation "net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.3.0"
    // https://github.com/square/okhttp/blob/master/CHANGELOG.md
    implementation "com.squareup.okhttp3:okhttp:4.9.3"
    implementation "com.squareup.okhttp3:logging-interceptor:4.9.3"

    // Open Source Licence List
    implementation "com.github.franmontiel:AttributionPresenter:1.0.1"

    // Shake to Send Feedback
    implementation "com.linkedin.shaky:shaky:3.0.4"
    implementation "com.jraska:falcon:2.2.0"

    // Page Indicator View
    implementation 'com.github.romandanylyk:PageIndicatorView:v.1.0.3'

    // Testing
    implementation "androidx.legacy:legacy-support-v4:1.0.0"
    testImplementation "junit:junit:4.13.2"
    testImplementation "androidx.test:core:1.4.0"
    testImplementation "org.mockito:mockito-core:4.6.0"
    androidTestImplementation "androidx.test:runner:1.4.0"
    androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
    androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.2.1")

    apply plugin: 'com.google.gms.google-services'
}

Module build file:

apply plugin: "com.github.ben-manes.versions"

buildscript {

    ext.kotlin_version = '1.6.10'

    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.5.2"
        classpath "com.google.firebase:firebase-crashlytics-gradle:2.9.2"
        classpath "com.google.gms:google-services:4.3.14"
        classpath "com.github.ben-manes:gradle-versions-plugin:0.42.0"
    }
}

allprojects {
    repositories {
        google()
        maven { url "https://jitpack.io" }
        mavenCentral()

        jcenter() {
            content {
                includeModule("com.google.android", "flexbox")
            }
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
1 Answers

In your app/build.gradle file in the android block add:

android {

   //..

   composeOptions {         
       kotlinCompilerExtensionVersion 1.3.1     
   }
}

According to the compatibility map use kotlin 1.7.10

Related