我们建议使用较新的Android Gradle插件来使用compileSdk = 34?

wqsoz72f  于 2023-08-01  发布在  Android
关注(0)|答案(1)|浏览(995)

嘿,伙计们,我怎么能更新到最新版本,因为我找不到最新的gradle-plugin。有人能在这方面指导我吗?

build.gradle(:app)

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

android {
    namespace "com.abc.xyz"
    compileSdk 34

    defaultConfig {
        applicationId "com.abc.xyz"
        minSdk 24
        targetSdk 34
        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 {
        kotlinCompilerExtensionVersion compose_compiler_version
    }
    packagingOptions {
        resources {
            excludes += "/META-INF/{AL2.0,LGPL2.1}"
        }
    }
}

dependencies {

    def composeBom = platform "androidx.compose:compose-bom:$compose_bom"
    implementation composeBom
    androidTestImplementation composeBom

    implementation("androidx.core:core-ktx:1.10.1")
    implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1")

    implementation("androidx.compose.ui:ui")
    implementation("androidx.compose.foundation:foundation")
    implementation("androidx.compose.foundation:foundation-layout")
    implementation("androidx.compose.material:material")
    implementation("androidx.compose.material3:material3")
    implementation("androidx.compose.runtime:runtime")
    implementation("androidx.compose.runtime:runtime-livedata")
    implementation("androidx.compose.ui:ui-tooling")
    implementation("androidx.compose.ui:ui-tooling-preview")
    implementation("androidx.lifecycle:lifecycle-viewmodel-compose")
    implementation("androidx.activity:activity-compose:$compose_activity")

    implementation("androidx.navigation:navigation-compose:$nav_version")

    implementation("io.insert-koin:koin-android:$koin_android_version")
    implementation ("io.insert-koin:koin-androidx-compose:$koin_android_compose_version")

    testImplementation("junit:junit:4.13.2")
    androidTestImplementation("androidx.test.ext:junit:1.1.5")
    androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
    androidTestImplementation("androidx.compose.ui:ui-test-junit4")
    debugImplementation("androidx.compose.ui:ui-tooling")
    debugImplementation("androidx.compose.ui:ui-test-manifest")
}

字符串

build.gradle(ExampleApp)

buildscript {
    ext {
        compose_compiler_version = "1.5.1"
        compose_activity = "1.7.2"
        compose_bom = "2023.06.01"
        koin_android_version = "3.4.0"
        koin_android_compose_version = "3.4.3"
        nav_version = "2.6.0"
    }
}

plugins {
    id "com.android.application" version '8.1.0' apply false
    id "com.android.library" version '8.1.0' apply false
    id "org.jetbrains.kotlin.android" version "1.9.0" apply false
}

gradle-wrapper.properties

#Fri Mar 17 15:27:20 GMT 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME


得到这个警告信息,我已经更新了一切,我错过了谁能告诉我?

We recommend using a newer Android Gradle plugin to use compileSdk = 34
    
    This Android Gradle plugin (8.1.0) was tested up to compileSdk = 33 (and compileSdkPreview = "UpsideDownCakePrivacySandbox").
    
    You are strongly encouraged to update your project to use a newer
    Android Gradle plugin that has been tested with compileSdk = 34.
    
    If you are already using the latest version of the Android Gradle plugin,
    you may need to wait until a newer version with support for compileSdk = 34 is available.
    
    To suppress this warning, add/update
        android.suppressUnsupportedCompileSdk=34
    to this project's gradle.properties.

kyxcudwk

kyxcudwk1#

但你还需要更新Gradle高于8.1.0,因为它更新为编译SDK 33,只有你会得到一个警告。

相关问题