LoginSignup
0
0

More than 1 year has passed since last update.

Unity+AdMob+iOSビルドが失敗したときに試したこと

Posted at

環境

macOS Big Sur 11.6.1
Unity Version 2020.3.21f1 Personal
GoogleMobileAds-v5.4.0.unitypackage
Xcode Version 13.1
CocoaPods Version 1.11.2

現象1

AdMobを導入したUnityプロジェクトをXcodeプロジェクトとして書き出して実行すると、以下のエラーメッセージが出てしまった。

'GoogleMobileAds/GoogleMobileAds.h' file not found

試したこと

iOSの依存関係のエラーを解決してくれるらしいので、以下の記事を参考にExternal Dependency Manager for Unity をインポートした。
記事には自分でDependencies.xmlを準備するとあったが、GoogleMobileAds-v5.4.0の中にそれらしきファイル(Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml)が存在したので、自分の環境では作らなかった。

現象2

最初は気づかなかったのだが、UnityでXcodeプロジェクトを書き出すと以下のエラーメッセージが出ていた。

iOS framework addition failed due to a CocoaPods installation failure. This will will likely result in an non-functional Xcode project.

試したこと

どうやらCocoaPodsが正しくインストールされていないようだったので、以下の記事を参考にCocoaPodsをインストールし直した。

自分の環境ではそれでもエラーが出たので、Unityのエラーメッセージに「実行しろ!」と書いてあったコマンドをそのままターミナルで実行してみた。

sudo gem install -n /usr/local/bin cocoapods
pod setup

コマンドを実行して

Setup completed

と表示されれば成功。

現象3

現象2と同じエラーメッセージがまた出ていたので、下にスクロールしてみるとCocoaPodsが以下のエラーメッセージを吐いていました。

CocoaPods requires your terminal to be using UTF-8 encoding.

試したこと

ターミナルのエンコードの問題だったので .bash_profile に以下の記述を追加

export LC_ALL="en_US.UTF-8"

これで自分の環境ではビルドに成功しました。
お役に立てば幸いです。

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