Ошибка "Dependency requires libraries and applications that depend on it to compile against version 33 or later"

Хочу обновить библиотеку androidx.core:core с 1.7.0 до 1.9.0, но получаю следующую ошибку:

3 issues were found when checking AAR metadata:

  1. Dependency 'androidx.core:core:1.9.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs.

    :app is currently compiled against android-32.

    Recommended action: Update this project to use a newer compileSdkVersion of at least 33, for example 33.

    Note that updating a library or application's compileSdkVersion (which allows newer APIs to be used) can be done separately from updating targetSdkVersion (which opts the app in to new runtime behavior) and minSdkVersion (which determines which devices the app can be installed on).

  2. ...

Файл build.gradle выглядит так:

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

android {
    namespace 'com.example.myapplication'
    compileSdk 32
    defaultConfig {
        applicationId "com.example.myapplication"
        minSdk 21
        targetSdk 32
        versionCode 1
        versionName "1.0"
    }   
    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 {
        viewBinding true
    }
}

dependencies {
    implementation 'androidx.room:room-ktx:2.4.3'
    kapt 'androidx.room:room-compiler:2.4.3'
    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.core:core:1.7.0'
    implementation 'androidx.support:support-compat:26.1.0'
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.4.1'
    implementation 'androidx.navigation:navigation-ui-ktx:2.4.1'
    implementation "android.arch.persistence.room:runtime:1.0.0"
    annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
}

Ответы (2 шт):

Автор решения: web developer

Просто выключите переключатель «Автономный режим» .

В верхней правой части окна.

Нажмите на опцию Gradle 2nd number (рядом с опцией «Настройка»), нажмите на нее, после чего вы сможете работать непрерывно.

Как вы можете видеть изображение введите сюда описание изображения

→ Ссылка
Автор решения: Vadik

Библиотека androidx.core:core версии 1.9.0 требует, чтобы версия compileSdk в вашем проекте была выставлена в значение 33 или выше.

Чтобы исправить ошибку, вы можете понизить версию этой библиотеки до 1.8.0 (не рекомендуется), либо обновить compileSdk и targetSdk до версии 33:

android {
    compileSdk 33
    ...

    defaultConfig {
        targetSdk 33
        ...

    }
}
→ Ссылка