ビルド時に…issues were found when checking AAR metadataエラーが発生した時の対応(Android Studio Kotlin)

,

Android Studioでビルド時や実行時に、例えば「10 issues wear found when checking AAR metadata」等のエラーが出たときの対処方法に関して記します。

エラー状況

ビルドや実行を行った時に以下の様に「…issues were found when checking AAR metadata」の表示がされて、「to compile against version 34 or later of the Android APIs」が表示されて「Recommended action: Update this project to use a newer compileSdk of at least 34, for example 34.」の様な表示がされます。(下の例ではエラーは1個なのでAn issue was found when checking AAR metadataとなっています)

An issue was found when checking AAR metadata:

1. Dependency 'androidx.activity:activity:1.8.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.

Recommended action: Update this project to use a newer compileSdk
of at least 34, for example 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).

開発環境等

開発ツールバージョン: Android Studio Giraffe 2022.3.1 Path3
使用言語: Kotlin

エラー原因

例えば上の例では、「androidx.activity:activity:1.8.0」と言うモジュールがAndroid APIsのバージョン34以降のものが必要だということです。よって少なくともバージョン34以上を使用する必要があります。

対処方法

以下に示すように、プロジェクトビューのGradle Scriptsのbuild.gradle.kts(Module:app)をダブルクリックしてファイルを開きます。
そのソースコードのcompileSdkを34以上にします。修正後「Sync Now」をクリックします。


PAGE TOP