googleads / googleads-mobile-unity

Official Unity Plugin for the Google Mobile Ads SDK
https://developers.google.com/admob/unity
Apache License 2.0
1.36k stars 1.08k forks source link

Native ads 5.4.0.90 MiniJson conflicts with Firebase (Mono only) #1587

Closed fouman75 closed 1 year ago

fouman75 commented 3 years ago

[REQUIRED] Step 1: Describe your environment

[REQUIRED] Step 2: Describe the problem

Google's Native Ads SDK comes with its own version of Google.MiniJson.dll (tagged 5.4.0.90). When using Firebase through Unity's package manager (v7.1.0), there is also an unmarked version of the same DLL. This leads to conflicts and one DLL needs to be deleted. 5.4.0.90 is deleted, since it's directly accessible in Asset/Plugins, whereas the other DLL comes from the package manager.

When building the project for Android (MONO, .Net4.x), Admob initializes properly but there is this error when fetching a native ad:

Method `Google.MiniJSON.Json.Deserialize(string)' is inaccessible from method `GoogleMobileAds.Common.Utils.CastAssetIDMappings(string)'
        at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_throw_method_access(intptr,intptr)
      at GoogleMobileAds.Common.Utils.CastAssetIDMappings (System.String jsonMappings) [0x00000] in <b12c1b9643d845f19ac2d2c567daabf2>:0 
      at _lrzYIkvPC4Ct86Sgf1d6FlyaJ3M._eXQBkxLYQ0eJrSK9oYuIIkse1ON._yEWsWlmKeotZALIGHFAKgQaP2JP () [0x0001c] in <8f3eaa6ff7794cdc9e7fa259b15563b5>:0 
      at _lrzYIkvPC4Ct86Sgf1d6FlyaJ3M._eXQBkxLYQ0eJrSK9oYuIIkse1ON..ctor (UnityEngine.AndroidJavaObject ) [0x00017] in <8f3eaa6ff7794cdc9e7fa259b15563b5>:0 
      at GoogleMobileAds.Android.AdLoaderClient.onUnifiedNativeAdLoaded (UnityEngine.AndroidJavaObject ad) [0x00030] in <8f3eaa6ff7794cdc9e7fa259b15563b5>:0 
        at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
      at System.Reflection.MonoMetho

NOTE: This error does not occur when building with IL2CPP. NOTE2: Without Firebase in the project, using the 5.4.0.90 version of MiniJson works for both Mono and IL2CPP.

Give that Firebase is a critical system (Crashlytics, Analytics, ...) and given that the MiniJson.dll is unmarked, it's unclear if replacing the DLL with the one provided by NativeAds would lead to major issues.

I know that this is just for Mono, but Mono is pretty indispensable for local development (an IL2CPP debuggable dev build takes 2h to build vs 5 minutes for Mono ...)

Any thoughts?

Steps to reproduce:

Relevant Code:

GoogleNativeAdsMinniJsonConflict.zip

bigyo-fourdesire commented 3 years ago

Same here.

Does anyone know a temporary workaround?

pfay-fc commented 2 years ago

A few users note in https://github.com/googleads/googleads-mobile-unity/issues/920#issuecomment-495705988 that they simply don't import the native ads version of the dll.

kunny commented 1 year ago

Since there were no recent activities for this issue, we are therefore reluctantly going to close this bug for now.

If you are still experiencing the problem, please file a new issue with the same description, what happens and system / network tracing / Charles logs.

All system setups can be slightly different, so it's always better to open new issues and reference the related ones. Thanks for your contribution.