Android Studio 检查AAR元数据时发现问题:需要android 34 complieSDK而不是33

yfjy0ee7  于 11个月前  发布在  Android
关注(0)|答案(1)|浏览(205)

在这里,我面临着一个问题,我刚刚创建了一个新的项目,并重新构建它,并有错误

An issue was found when checking AAR metadata:

字符串
1.依赖于“androidx.activity:activity:1.8.0 "的库和应用程序需要根据34版或更高版本的Android API进行编译。
:应用程序目前针对android-33编译。
建议的操作:更新此项目以使用至少为34的较新compileSdk,例如34。
请注意,更新库或应用程序的compileSdk(允许使用较新的API)可以与更新targetSdk(选择应用程序进入新的运行时行为)和minSdk(确定应用程序可以安装在哪些设备上)分开进行。
我没有添加任何新的东西.我也有重新安装的android工作室,也尝试了不同的构建版本.我没有选择来修复这个错误.
项目结构:Android Gradle Plugin Version
build.gradle:

plugins {
    id 'com.android.application'
}

android {
    namespace 'com.mamacode.ride'
    compileSdk 33

    defaultConfig {
        applicationId "com.mamacode.ride"
        minSdk 26
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

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

dependencies {

    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.10.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}


我面临这个错误后,我已经更新了android工作室长颈鹿
当我设置miniPhoneSDK为34是说找不到sdk版本.

62o28rlo

62o28rlo1#

android {
namespace 'com.mamacode.ride'
compileSdk 34

defaultConfig {
    applicationId "com.mamacode.ride"
    minSdk 26
    targetSdk 34
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

字符串
targetSdkcompileSdk修改为34

相关问题