状況
- 新規プロジェクト作成
- ビルドボタン押す
- こける
エラー
2 issues were found when checking AAR metadata:
1. Dependency 'androidx.core:core:1.15.0' requires libraries and applications that
depend on it to compile against version 35 or later of the
Android APIs.
:app is currently compiled against android-34.
Recommended action: Update this project to use a newer compileSdk
of at least 35, for example 35.
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).
2. Dependency 'androidx.core:core-ktx:1.15.0' requires libraries and applications that
depend on it to compile against version 35 or later of the
Android APIs.
:app is currently compiled against android-34.
Recommended action: Update this project to use a newer compileSdk
of at least 35, for example 35.
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).
Update minCompileSdk in modules with dependencies that require a higher minCompileSdk.
内容
- 使用しているライブラリのバージョンとプロジェクトの設定に不整合がある
- androidx.core:core:1.15.0 と androidx.core:core-ktx:1.15.0 の両方が、Android API レベル 35 以上での実行を要求しているが現在のプロジェクトは API レベル 34 で設定している
結論
- compileSdk を35に更新したらビルドできた
android {
compileSdk 35 // 34から35に変更
defaultConfig {
// 他の設定はそのまま
}
}
Android Studioくん、何もしてないのに初手でビルド転けるのやめてほしい
最初から35に向けといてくれよ...