LoginSignup
4
3

More than 1 year has passed since last update.

Android Studioでのビルドエラー

Last updated at Posted at 2023-01-20

概要

久しぶりにAndroidの新規プロジェクトを立ち上げたら、いきなりビルドエラーを吐いてしまった。

エラーメッセージ全文

6 issues were found when checking AAR metadata:

  1.  Dependency 'androidx.appcompat:appcompat-resources:1.6.0' requires libraries and applications that
      depend on it to compile against version 33 or later of the
      Android APIs.

      :app is currently compiled against android-32.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 7.4.0-alpha03 is 32.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 33, then update this project to use
      compileSdkVerion of at least 33.

      Note that updating a library or application's compileSdkVersion (which
      allows newer APIs to be used) can be done separately from updating
      targetSdkVersion (which opts the app in to new runtime behavior) and
      minSdkVersion (which determines which devices the app can be installed
      on).

  2.  Dependency 'androidx.appcompat:appcompat:1.6.0' requires libraries and applications that
      depend on it to compile against version 33 or later of the
      Android APIs.

      :app is currently compiled against android-32.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 7.4.0-alpha03 is 32.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 33, then update this project to use
      compileSdkVerion of at least 33.

      Note that updating a library or application's compileSdkVersion (which
      allows newer APIs to be used) can be done separately from updating
      targetSdkVersion (which opts the app in to new runtime behavior) and
      minSdkVersion (which determines which devices the app can be installed
      on).

  3.  Dependency 'androidx.activity:activity:1.6.0' requires libraries and applications that
      depend on it to compile against version 33 or later of the
      Android APIs.

      :app is currently compiled against android-32.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 7.4.0-alpha03 is 32.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 33, then update this project to use
      compileSdkVerion of at least 33.

      Note that updating a library or application's compileSdkVersion (which
      allows newer APIs to be used) can be done separately from updating
      targetSdkVersion (which opts the app in to new runtime behavior) and
      minSdkVersion (which determines which devices the app can be installed
      on).

  4.  Dependency 'androidx.core:core:1.9.0' requires libraries and applications that
      depend on it to compile against version 33 or later of the
      Android APIs.

      :app is currently compiled against android-32.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 7.4.0-alpha03 is 32.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 33, then update this project to use
      compileSdkVerion of at least 33.

      Note that updating a library or application's compileSdkVersion (which
      allows newer APIs to be used) can be done separately from updating
      targetSdkVersion (which opts the app in to new runtime behavior) and
      minSdkVersion (which determines which devices the app can be installed
      on).

  5.  Dependency 'androidx.core:core-ktx:1.9.0' requires libraries and applications that
      depend on it to compile against version 33 or later of the
      Android APIs.

      :app is currently compiled against android-32.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 7.4.0-alpha03 is 32.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 33, then update this project to use
      compileSdkVerion of at least 33.

      Note that updating a library or application's compileSdkVersion (which
      allows newer APIs to be used) can be done separately from updating
      targetSdkVersion (which opts the app in to new runtime behavior) and
      minSdkVersion (which determines which devices the app can be installed
      on).

  6.  Dependency 'androidx.annotation:annotation-experimental:1.3.0' requires libraries and applications that
      depend on it to compile against version 33 or later of the
      Android APIs.

      :app is currently compiled against android-32.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 7.4.0-alpha03 is 32.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 33, then update this project to use
      compileSdkVerion of at least 33.

      Note that updating a library or application's compileSdkVersion (which
      allows newer APIs to be used) can be done separately from updating
      targetSdkVersion (which opts the app in to new runtime behavior) and
      minSdkVersion (which determines which devices the app can be installed
      on).

エラーメッセージを読み解く

  1.  Dependency 'androidx.appcompat:appcompat-resources:1.6.0' requires libraries and applications that
      depend on it to compile against version 33 or later of the
      Android APIs.

'androidx.appcompat:appcompat-resources:1.6.0' はバージョン33以降でコンパイルする必要があります。

とのこと。読み進めていくと推奨される対処法も出てきました

Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 33, then update this project to use
      compileSdkVerion of at least 33.

Android Gradle プラグインのバージョンを 33 に対応するものに更新すればいいみたいです。
build.gradleのcompileSdkとtargetSdkを32から33に変更しました。
すると、こんなエラーが

Could not identify launch Activity: Default Activity not found

起動アクティビティを特定できませんでした。デフォルトのアクティビティが見つかりません

調べてみたところ、どうやらmanifestsに問題があるようで、確認するとAndroidManifest.xmlの14行目が

tools:targetApi="32"

となっていたため、33に直してあげたら無事実行できました。

参考にした記事

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3