質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

Unity3D

Unity3Dは、ゲームや対話式の3Dアプリケーション、トレーニングシュミレーション、そして医学的・建築学的な技術を可視化する、商業用の開発プラットフォームです。

Unity

Unityは、Unity Technologiesが開発・販売している、IDEを内蔵するゲームエンジンです。主にC#を用いたプログラミングでコンテンツの開発が可能です。

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Q&A

解決済

1回答

10662閲覧

UnityアプリのAndroidビルドエラーについて

yuyusaki

総合スコア11

Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

Unity3D

Unity3Dは、ゲームや対話式の3Dアプリケーション、トレーニングシュミレーション、そして医学的・建築学的な技術を可視化する、商業用の開発プラットフォームです。

Unity

Unityは、Unity Technologiesが開発・販売している、IDEを内蔵するゲームエンジンです。主にC#を用いたプログラミングでコンテンツの開発が可能です。

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

1グッド

0クリップ

投稿2021/12/31 01:24

前提・実現したいこと

ひとまず簡単なゲームを作成し、Androidビルドを行っています。
実機テストを行っていた時は問題なくビルドできていたのですが
Android用に色々設定を変更してビルドするとエラーが発生するようになりました。

※以下参考にしたサイト
https://youdoyou-motto.com/unityto-googleplayrelease#google_vignette

発生している問題・エラーメッセージ

unityのコンソールに表示されているエラーログは下記の通りです。

Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details > Configure project :launcher WARNING: The option setting 'android.enableR8=false' is deprecated. It will be removed in version 5.0 of the Android Gradle plugin. You will no longer be able to disable R8 Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01 Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01 (Mapping new~から始まる同じようなログが数十行あるため省略) Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01 Mapping new ns http://schemas.android.com/repository/<message truncated>
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01 Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01 Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01 Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01 FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':launcher:bundleReleaseResources'. > Installed Build Tools revision 32.0.0 is corrupted. Remove and install again using the SDK Manager. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 10s Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
CommandInvokationFailure: Gradle build failed. C:\Program Files\Unity\Hub\Editor\2020.3.17f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2020.3.17f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-6.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "bundleRelease" stderr[ Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01 Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01 Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01 Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01 FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':launcher:bundleReleaseResources'. > Installed Build Tools revision 32.0.0 is corrupted. Remove and install again using the SDK Manager. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 10s Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 ] stdout[ Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details > Configure project :launcher WARNING: The option setting 'android.enableR8=false' is deprecated. It will be removed in version 5.0 of the Android Gradle plugin. You will no longer be able to disable R8 Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01 Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01 (Mapping new~から始まる同じようなログが数十行あるため省略) Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01 Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01 Mapping new ns<message truncated>
Build completed with a result of 'Failed' in 70 seconds (69532 ms)
UnityEditor.BuildPlayerWindow+BuildMethodException: 4 errors at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in <d0e4b8c1204147f3935b6e9c8b8565ad>:0 at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <d0e4b8c1204147f3935b6e9c8b8565ad>:0

試したこと

上記の参考URLに記載されていた以下の設定を入れています。
●ビルド設定にて
App Bundleをビルド(GooglePlay)にチェック
symbols.zipを作成にチェック
開発モード無効にチェック
●プレイヤー設定にて
キーストアの設定
企業名やプロダクト、アイコン等の設定
その他設定>スクリプティングバックエンド>IL2CPP
その他設定>ターゲットアーキテクチャ>ARM64のみチェック
その他設定>スタックトレース>全て「None」にチェック

ネットにはプロジェクトパスに全角文字が含まれているエラーが多いとありましたが
今回はパスは全て半角文字しか含まれておりません。

また、ここに来るまでに別のエラーの対策として、AndroidStudioをインストールしており、
そちらのSDKを見るように、編集>環境設定>外部ツール>AndroidのSDKパスだけチェックを外して以下に設定しています。
C:\Users\ユーザー名\AppData\Local\Android\sdk

よろしくお願いいたします。

yamasho69👍を押しています

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

fiveHundred

2021/12/31 02:08

> Installed Build Tools revision 32.0.0 is corrupted. Remove and install again using the SDK Manager. とありますが、「Build Tools revision 32.0.0」の再インストールは行ったのでしょうか?
yuyusaki

2021/12/31 02:18

Android StudioのBuild Toolは再インストールして試しましたが改善しませんでした。 Unity側で外部ツール>AndroidSDKのパスを指定していますので、 AndroidStudio側でSDKやBuild Toolの更新をかければUnity側にも効くという認識で合ってますでしょうか? (Unity側でBuildToolの更新や削除を行う設定画面がありますか?)
fiveHundred

2021/12/31 02:33

解釈自体はそれで合ってます。 それで上手くいかないのであれば、Unity公式としては、AndroidStudioのSDKではなく、Unity付属のSDKを使うのが推奨されているので、そちらで試すのがよろしいかと思います。
guest

回答1

0

ベストアンサー

私も以前同じエラーに遭遇しました。私の場合はUnityの2019を使っていたので、2022にプロジェクトをアップグレードすることで対処しました。(アップグレードするとSDK、JDKなどの設定を自動的に行ってくれました。)お役に立てればうれしいです。

投稿2021/12/31 02:24

RyuHo

総合スコア42

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

fiveHundred

2021/12/31 02:39

2022年版はいわゆるベータテスト版ですので、動作が安定していない可能性もあり、おすすめできません。 UnityHubにLTSと付いているのは「長期的にサポートしますよ」というものなので、新しい機能にこだわらないのであれば、それが付いている中で最新のバージョン(現状では2020.3)を使うのがよろしいかと思います。
yuyusaki

2021/12/31 04:04

皆様、アドバイスいただきありがとうございます。 その後、RyuHoさんの情報通りUnity別バージョンにプロジェクトをアップグレードしたところ 無事ビルドできました! 2022は不安定ということでしたので、2020.3.25f1に変更してみました。(元は2020.3.17f1) さらに、fiveHundredさんのご指摘の通りAndroidSDKではなく、UnityのSDKに戻して試したところ すんなりビルドが通りました。(2020.3.17f1の時は通りませんでした) ネットに記載されていた情報は、「Unity付属のSDKでは最新のAndroidAPIレベルに対応していないため AndroidStudioのSDKを使う」というものだと認識していますが、その後Unity自体がバージョンアップにより 公式でサポートされるようになったということなのでしょうか。。。 いずれにせよ、UnityのSDKだけでビルドが通るのでAndroidStudioは今のところ不要になりました^^; アドバイスいただきありがとうございました!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問