AAR 元数据错误 - Android Studio (kotlin)

问题描述 投票:0回答:1

检查AAR元数据时发现3个问题:

  1. 依赖项“androidx.activity:activity:1.8.0”需要以下库和应用程序 依赖它来针对版本 34 或更高版本进行编译 Android API。

    :应用程序当前是针对 android-33 编译的。

    此外,Android Gradle 的最大推荐编译 SDK 版本 插件 7.4.2 是 33.

    建议采取的措施:更新此项目的 Android Gradle 版本 插件到支持34位的,然后更新这个项目来使用 compileSdkVerion 至少为 34。

    请注意,更新库或应用程序的compileSdkVersion(其中 允许使用更新的 API)可以与更新分开完成 targetSdkVersion(选择应用程序新的运行时行为)和 minSdkVersion(决定应用程序可以安装的设备 开)。

  2. 依赖项“androidx.core:core-ktx:1.12.0”需要以下库和应用程序 依赖它来针对版本 34 或更高版本进行编译 Android API。

    :应用程序当前是针对 android-33 编译的。

    此外,Android Gradle 的最大推荐编译 SDK 版本 插件 7.4.2 是 33.

    建议采取的措施:更新此项目的 Android Gradle 版本 插件到支持34位的,然后更新这个项目来使用 compileSdkVerion 至少为 34。

    请注意,更新库或应用程序的compileSdkVersion(其中 允许使用更新的 API)可以与更新分开完成 targetSdkVersion(选择应用程序新的运行时行为)和 minSdkVersion(决定应用程序可以安装的设备 开)。

  3. 依赖项“androidx.core:core:1.12.0”需要以下库和应用程序 依赖它来针对版本 34 或更高版本进行编译 Android API。

    :应用程序当前是针对 android-33 编译的。

    此外,Android Gradle 的最大推荐编译 SDK 版本 插件 7.4.2 是 33.

    建议采取的措施:更新此项目的 Android Gradle 版本 插件到支持34位的,然后更新这个项目来使用 compileSdkVerion 至少为 34。

    请注意,更新库或应用程序的compileSdkVersion(其中 允许使用更新的 API)可以与更新分开完成 targetSdkVersion(选择应用程序新的运行时行为)和 minSdkVersion(决定应用程序可以安装的设备 开)。

我试图更新 Gradle,但它已经告诉我它是最新的。

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

android {
    namespace ''
    compileSdk 33

    defaultConfig {
        applicationId ""
        minSdk 24
        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
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {

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

我正在尝试使用我的 Android 设备来测试应用程序或构建 APK,但到目前为止,此错误消息不断出现,我正在寻求一些帮助。

android-studio aar
1个回答
0
投票

尝试将compileSdk从33更新到34。

首先在sdk管理器中下载“Android Api 34”。

然后在您的项目中更新:文件/项目结构/模块/编译Sdk版本/“选择34(Api 4)”

我希望它对你有用。

© www.soinside.com 2019 - 2024. All rights reserved.