3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Unity 2022 Androidビルドでエラーへの対処(AndroidSDK)

Last updated at Posted at 2023-07-02

Unity2022のエディタでのAndroidビルドエラーを試みた際に、ビルドが通らなかったのですが、無事解決できましたので手順を記載しておきます。

環境:
Windows10
Unity 2022.3.4f1

事象:
Build SettingからAndroidビルドを作成したところ、3件のエラーが発生。
キャプチャ1.JPG
最初のエラーからAndroid SDKに問題がありそうです。

Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.4f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\32.0.0\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.4f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.4f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-31\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.4f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-32\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.4f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.4f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\32.0.0\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.4f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.4f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-31\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.4f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-32\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.4f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only
> Task :unityLibrary:preBuild UP-TO-DATE
> Task :launcher:preBuild UP-TO-DATE
> Task :unityLibrary:preReleaseBuild UP-TO-DATE

解決策:
Project Setting>Player>Other Settings Identification
からAPIレベルを最新のAndroid 13.0 (API level 33)を選択した上で再ビルド。
インストールが自動で入って無事ビルドが通りました。
キャプチャ4.JPG
キャプチャ5.JPG
キャプチャ6.JPG

最後に:
Unity2022で2023年春頃から始めた方はここでかなり引っかかるんじゃないかと思います。
3つ目のエラーからGradleのバージョンを疑いGradleの公式サイトからバージョン違いのファイルをPathへアップデートする手法も試しましたが、改善しませんでした。Androidのビルドが通らないのはAPIレベルの問題かもしれないです。Project Settingも確認してみてください。

3
0
1

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
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?