Обновление до Jetpack Compose спецификации 2023.08.00 требует, чтобы я изменил targetSdk на 34

Я использую составную спецификацию для управления составленными версиями в проекте. Я обновил версию bom до 2023:08:00, и теперь я получаю эту ошибку:

An issue was found when checking AAR metadata:

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

   :app is currently compiled against android-33.

   Also, the maximum recommended compile SDK version for Android Gradle
   plugin 8.1.0 is 33.

   Recommended action: Update this project's version of the Android Gradle
   plugin to one that supports 34, then update this project to use
   compileSdk of at least 34.

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

Как я могу обновить свою версию compose, не меняя compileSdk и targetSdk на 34?

Уровень проекта:

buildscript {
    ext {
        gradle_version = '8.1.0'
        kotlin_version = '1.9.0'
        ksp_version = '1.9.0-1.0.13'
        compose_bom_version = '2023.08.00'
        compose_compiler_version = '1.5.1'
        accompanist_version = '0.31.6-rc'
        hilt_version = '2.44.1'
        hilt_navigation_compose_version = '1.0.0'
        room_version = '2.5.2'
    }
}
plugins {
    id 'com.android.application' version "${gradle_version}" apply false
    id 'org.jetbrains.kotlin.android' version "${kotlin_version}" apply false
    id 'com.google.dagger.hilt.android' version "${hilt_version}" apply false
    id 'com.google.devtools.ksp' version "${ksp_version}" apply false
}

Уровень приложения:

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'com.google.dagger.hilt.android'
    id 'com.google.devtools.ksp'
    id 'kotlin-kapt'
    id 'kotlin-parcelize'
}

android {
    namespace ''
    compileSdk 33

    defaultConfig {
        applicationId ""
        minSdk 29
        targetSdk 33
        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_17
        targetCompatibility JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = '17'
    }
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion compose_compiler_version
    }
    packaging {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
}

dependencies {
    
    implementation 'androidx.core:core-ktx:1.10.1'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
    implementation 'androidx.activity:activity-compose:1.7.2'
    implementation "androidx.constraintlayout:constraintlayout-compose:1.0.1"
    implementation "androidx.navigation:navigation-compose:2.6.0"

    // Hilt
    implementation "com.google.dagger:hilt-android:$hilt_version"
    kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
    implementation "androidx.hilt:hilt-navigation-compose:$hilt_navigation_compose_version"

    // Room
    implementation "androidx.room:room-runtime:$room_version"
    ksp "androidx.room:room-compiler:$room_version"

    // Jetpack Compose
    implementation platform("androidx.compose:compose-bom:$compose_bom_version")
    implementation "androidx.compose.ui:ui"
    implementation 'androidx.compose.ui:ui-graphics'
    implementation "androidx.compose.ui:ui-tooling-preview"
    implementation 'androidx.compose.material3:material3'
    implementation 'androidx.compose.material3:material3-window-size-class'
    debugImplementation "androidx.compose.ui:ui-tooling"
    debugImplementation "androidx.compose.ui:ui-test-manifest"

    // Accompanist
    implementation "com.google.accompanist:accompanist-navigation-animation:$accompanist_version"
    implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist_version"

    // Splash
    implementation "androidx.core:core-splashscreen:1.0.1"

    // Test
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    androidTestImplementation platform("androidx.compose:compose-bom:$compose_bom_version")
    androidTestImplementation "androidx.compose.ui:ui-test-junit4"
}

Я попытался обновить версию ведомости материалов для реактивного ранца до последней версии, не ориентируясь на Android 14.

Я знаю, что могу изменить только compileSdk на 34, но я не хочу менять и это.

Roman 12.08.2023 09:20

Почему вы боитесь менять версию compileSdk?

CommonsWare 12.08.2023 12:56

это может привести к неожиданным изменениям @CommonsWare

Roman 13.08.2023 10:16

Вы можете получить несколько новых интересных предупреждений Lint. Вот об этом.

CommonsWare 13.08.2023 12:29
0
4
93
2
Перейти к ответу Данный вопрос помечен как решенный

Ответы 2

Ответ принят как подходящий

Та же ситуация, и я просто меняю версию compileSdk и buildToolsVersion на 34 (и 34.0.0). Это не требует от вас изменения версии targetSdk.

Другие вопросы по теме