facebook twitter hatena line email

Unity/GoogleMobileAds/バージョンアップ

提供: 初心者エンジニアの簡易メモ
2021年3月19日 (金) 00:21時点におけるAdmin (トーク | 投稿記録)による版 (Unityのプレビュー時に"Could not find key in plist file: [DATABASE_URL]"が出る場合)

移動: 案内検索

6系から7系へ

具体的には、6.15.2から7.1.0へ変更したときのエラーメモ

DllNotFoundException: FirebaseCppApp-7_1_0エラーが出るとき

FirebaseAnalytics.unitypackageとかのファイルからインストールするのをやめて、 Window/PackageManagerのFirebaseAnalyticsとかからinstallする。

古いfirebaseなどは削除。以下辺り

  • Assets/Editor\ Default\ Resources/Firebase
  • Assets/Firebase
  • Plugins/iOS
  • Plugins/x86_64

RemoteConfig更新

staticからinstance生成形式に

- Task fetchTask = Firebase.RemoteConfig.FirebaseRemoteConfig.FetchAsync(new TimeSpan(0));
+ Task fetchTask = Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.FetchAsync(new TimeSpan(0));

-  Debug.Log("version=" + Firebase.RemoteConfig.FirebaseRemoteConfig.GetValue("version").StringValue);
+ Debug.Log("version=" + Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.GetValue("version").StringValue);

ActivateFetchedのメソッドが削除され使えない場合

ActivateAsyncへ変更して修正

- Firebase.RemoteConfig.FirebaseRemoteConfig.ActivateFetched();
+ Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.ActivateAsync();

'Packages/com.google.firebase.app/Parse/Plugins/dotNet45/Unity.Compat.dll' conflicts with:エラーが出るとき

unitypackageとPackageManagerでいれたdllが競合してると思われるので、 Assets/Parse/Pluginsにある、Unity.Compat.dllとかを削除すればよい。

iosのpod updateで、"`FirebaseAnalytics` requires CocoaPods version `>= 1.10.0`, which is not satisfied by your current version, `1.9.3"エラーが出る場合

以下実行

sudo gem update -n /usr/local/bin cocoapods

iosで、"Showing Recent Messages Undefined symbol: _RequestReview"エラーが出るとき

Showing Recent Messages Undefined symbol: _RequestReview

レビューライブラリを入れてる場合、削除されてない確認。削除されていれば追加して。replaceでビルド。

Assets/Plugins/iOS/ReviewPlugin.mm

iosで"Showing Recent Messages Undefined symbol: _OBJC_CLASS_$_GKLocalPlayer"エラーが出るとき

GameKit.frameworkをUnityFrameworkに追加して、コード修正すれば直ると書いてる。

手順:

  1. Build PhrasesでUnityFrameworkを選択し、Link Binary With Librarysを選択し、+を押す
  2. GameKit.frameworkを選択して追加
  3. Pods/FirebaseAuth/FirebaseAuth/Sources/AuthProvider/GameCenter/FIRGameCenterAuthProvider.m を開き
  4. 41行目に以下追加
    if (completion) {
        completion(nil, [FIRAuthErrorUtils gameKitNotLinkedError]);
    }
    return;

しばらく同じ現象が出てたが、xcodeを一度再起動したところ、エラーが消えた。

参考:https://github.com/firebase/quickstart-unity/issues/898

参考:https://github.com/facebook/facebook-sdk-for-unity/issues/504

Androidビルドで"output: Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 The APKs have been extracted in the directory:"が起こるとき

  • keyがdebugになっていて、インストール端末と、合わなかったので、customのkeyにしたところ直った。

課金ロジックが動かない場合

The name 'AppleTangle' does not exist in the current context The name 'GooglePlayTangle' does not exist in the current context

  1. Window/Unity IAP/Receipt Validation Obfuscatorを開き
  2. Obfuscate Google Play License Keyを、入力し、生成すれば改善する


参考:http://yamakengames.seesaa.net/article/464510567.html

iosで"initialized without AppMeasurement"エラーが出る場合

以下メッセージが出る場合

Exception	NSException *	"The Google Mobile Ads SDK was initialized without AppMeasurement. Google AdMob publishers, follow instructions here: https://googlemobileadssdk.page.link/admob-ios-update-plist to include the AppMeasurement framework and set the -ObjC linker flag. Google Ad Manager publishers, follow instructions here: https://googlemobileadssdk.page.link/ad-manager-ios-update-plist"	0x00000002801a49f0

UnityのAssets/GoogleMobileAds/Resources/GoogleMobileAdsSettings.assetのGoogleAdManagerのEnabledにチェックを付ける。

(AdManagerで必要で、AdMobでは必要ないが、何故かこれが出てるときに、チェックを入れると直った)

Unityのプレビュー時に"Could not find key in plist file: [DATABASE_URL]"が出る場合

エラー詳細

Generation of the Firebase Android resource file google-services.xml from Assets/GoogleService-Info.plist failed.
If you have not included a valid Firebase Android resources in your app it will fail to initialize.

"python" "/System/Volumes/Data/d/www/unity/sample.unity/GrowWhale/Assets/Firebase/Editor/generate_xml_from_google_services_json.py" -i "Assets/GoogleService-Info.plist" -l --plist

Could not find key in plist file: [DATABASE_URL]

Assets/GoogleService-Info.plistに、DATABASE_URLが、含まれてないので、以下のように、含むように

<key>DATABASE_URL</key>
<string>https://[ここがプロジェクトidで置換する}.firebaseio.com</string>

ほか対応したこと

  • Androidは、ARM64対応
  • Androidビルドはもともと29だったので、29へ
  • 以下Androidのカスタムビルドファイルをonへ
Assets/Plugins/Android/gradleTemplate.properties
Assets/Plugins/Android/mainTemplate.gradle
Assets/Plugins/Android/AndroidManifest.xml

iosで広告が出ない現象が発生した

まっさらプロジェクトから、ライブラリを入れて対応したが、この現象にぶち当たった、 unityのバージョンが2020.1.14f1だったので、最新の2020.3.0f1にしたら直った。詳しくは以下へ

Unity/バージョンアップメモ/unity2020.3.0f1 [ショートカット]