「Unity/GoogleMobileAds/バージョンアップ」の版間の差分

提供: 初心者エンジニアの簡易メモ
ナビゲーションに移動 検索に移動
編集の要約なし
 
(同じ利用者による、間の3版が非表示)
1行目: 1行目:
==firebase-6系から7系へ==
[[Unity/GoogleMobileAds/バージョンアップ/5.4.0から6.1.0へ]]
具体的には、6.15.2から7.1.0へ変更したときのエラーメモ
===DllNotFoundException: FirebaseCppApp-7_1_0エラーが出るとき===
FirebaseAnalytics.unitypackageとかのファイルからインストールするのをやめて、
Window/PackageManagerのFirebaseAnalyticsとかからinstallする。


古いfirebaseなどは削除。以下辺り
[[Unity/GoogleMobileAds/バージョンアップ/firebase-6系から7系へ]]
* Assets/Editor\ Default\ Resources/Firebase
* Assets/Firebase
* Plugins/iOS
* Plugins/x86_64


===RemoteConfig更新===
[[Unity/GoogleMobileAds/バージョンアップ/ver3からver4へ]]
====staticからinstance生成形式に====
<pre>
- 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);
</pre>
 
====ActivateFetchedのメソッドが削除され使えない場合====
ActivateAsyncへ変更して修正
<pre>
- Firebase.RemoteConfig.FirebaseRemoteConfig.ActivateFetched();
+ Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.ActivateAsync();
</pre>
 
====SetDefaultsのメソッドが使えない場合====
SetDefaultsAsyncへ変更して修正
<pre>
- Firebase.RemoteConfig.FirebaseRemoteConfig.SetDefaults(defaults);
+ Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.SetDefaultsAsync(defaults);
</pre>
 
==='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"エラーが出るとき===
<pre>
Showing Recent Messages Undefined symbol: _RequestReview
</pre>
 
レビューライブラリを入れてる場合、削除されてない確認。削除されていれば追加して。replaceでビルド。
Assets/Plugins/iOS/ReviewPlugin.mm
 
===iosで"Showing Recent Messages Undefined symbol: _OBJC_CLASS_$_GKLocalPlayer"エラーが出るとき===
GameKit.frameworkをUnityFrameworkに追加して、コード修正すれば直ると書いてる。
 
手順:
#Build PhrasesでUnityFrameworkを選択し、Link Binary With Librarysを選択し、+を押す
#GameKit.frameworkを選択して追加
#Pods/FirebaseAuth/FirebaseAuth/Sources/AuthProvider/GameCenter/FIRGameCenterAuthProvider.m を開き
#41行目に以下追加
<pre>
    if (completion) {
        completion(nil, [FIRAuthErrorUtils gameKitNotLinkedError]);
    }
    return;
</pre>
しばらく同じ現象が出てたが、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
 
#Window/Unity IAP/Receipt Validation Obfuscatorを開き
#Obfuscate Google Play License Keyを、入力し、生成すれば改善する
 
 
参考:http://yamakengames.seesaa.net/article/464510567.html
 
==iosで"initialized without AppMeasurement"エラーが出る場合==
以下メッセージが出る場合
<pre>
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
</pre>
 
UnityのAssets/GoogleMobileAds/Resources/GoogleMobileAdsSettings.assetのGoogleAdManagerのEnabledにチェックを付ける。
 
(AdManagerで必要で、AdMobでは必要ないが、何故かこれが出てるときに、チェックを入れると直った)
 
==Unityのプレビュー時に"Could not find key in plist file: [DATABASE_URL]"が出る場合==
エラー詳細
<pre>
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]
</pre>
 
Assets/GoogleService-Info.plistに、DATABASE_URLが、含まれてないので、以下のように、含むように
 
<pre>
<key>DATABASE_URL</key>
<string>https://[ここがプロジェクトidで置換する].firebaseio.com</string>
</pre>
 
==iosだけanalyticsが反応しなかった問題==
以下対応で直ったかも(とりあえず、iosの解析に表示されるようになった)
*上の項目のDATABASE_URLがなかったを追加したこと
*初期に設定に以下を追加したこと
MobileAds.Initialize(initStatus => { });
 
==ほか対応したこと==
 
*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]] [ショートカット]
 
あと、facebookのmediationを使っていて、それを外すと使えるようになった。
エラーログなど、何も出てなかったので、すごくたちが悪かったです。
一旦以下のようコメントアウトにして、iosだけfacebookを外す。
 
Assets/GoogleMobileAds/Editor/FacebookMediationDependencies.xml
<pre>
<!--
  <iosPods>
    <iosPod name="GoogleMobileAdsMediationFacebook" version="6.2.1.0">
      <sources>
        <source>https://github.com/CocoaPods/Specs</source>
      </sources>
    </iosPod>
  </iosPods>
-->
</pre>
 
あとで原因考えましたが、よく見てないですが、facebookのAudienceNetwork管理画面側で、
ios14対応のIDFA問題あたりの追加設定あたりが、もしかすると、抜けてるのかも。

2021年8月31日 (火) 14:38時点における最新版