Home > Software engineering >  I want to use LazyVerticalGrid
I want to use LazyVerticalGrid

Time:07-02

Wow! This is my first question in stackoverflow. And my english is not good yet. I want to use LazyVerticalGrid. So I try to change compose_version to '1.1.1'.

e: This version (1.1.1) of the Compose Compiler requires Kotlin version 1.6.10 but you appear to be using Kotlin version 1.5.31 which is not known to be compatible.  Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).

But I use Kotlin 1.7.0. Oh, tool is Android studio. I already checked android studio Kotlin version.

I changed build.gradle(:app)

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
}

android {
    compileSdk 32

    defaultConfig {

        minSdk 30
        targetSdk 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerVersion "1.6.4"
        kotlinCompilerExtensionVersion '1.1.1'
    }
    packagingOptions {
        resources {
            excludes  = '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
}

dependencies {
    implementation "androidx.compose.compiler:compiler:1.1.1"
    implementation 'androidx.core:core-ktx:1.8.0'
    implementation "androidx.compose.ui:ui:$compose_version"
    implementation "androidx.compose.material:material:$compose_version"
    implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
    implementation 'androidx.activity:activity-compose:1.4.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
    debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
    debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
}

build.gradle(app)

    buildscript {
        ext {
            compose_version = '1.1.1'
            kotlin_verison='1.6.4'
        }
    }// Top-level build file where you can add configuration options common to all sub-projects/modules.
    plugins {
        id 'com.android.application' version '7.2.1' apply false
        id 'com.android.library' version '7.2.1' apply false
        id 'org.jetbrains.kotlin.android' version '1.5.31' apply false
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }

common to all sub-projects/modules.

second error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Compilation error. See log for more details

some scripts told me you have to changed dependencies. but how?... Is there a secret to adding a dependencies that fits the error?

CodePudding user response:

buildscript {
        ext {
            compose_version = '1.1.1'
            kotlin_verison='1.6.4'  >>>> Typo
        }
    }// Top-level build file where you can add configuration options common to all sub-projects/modules. 

you have a typo on kotlin_version

And on the first error, it tells you to use minimum kotlin version 1.6.10.

you just need to change this line from version '1.5.31' to 1.6.10 or the newest version of it.

id 'org.jetbrains.kotlin.android' version '1.5.31' apply false
  • Related