Problem integrating AdMob plugin into my Unity Project

710 views
Skip to first unread message

Evangelos Oganesof

unread,
Jul 1, 2022, 3:17:35 PM7/1/22
to Google Mobile Ads SDK Developers
Hi, I have to integrate AdMob into my Unity Project. 
I followed the steps of installing the latest unity package from the official guide, I did install GoogleMobileAds-v7.1.0.unitypackage then I installed GoogleMobileAds-Ad-Placements.unitypackage. I ran Resolve, Force Resolve, and Delete Resolved Libraries
then I did the GoogleMobileAdsSettings setup by enabling
Google AdMob Enabled = ✔ , AdMob App ID Android = "Filled with my app admob id"
then i went to my initializing script and added these lines of code 
/////////////////////////////////////////////////////
using GoogleMobileAds.Api;

void Start(){
AdModInit();
}

void AdModInit(){
         Status = "Initializing Ads Service";
         // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(initStatus => {
            Status = "Ads Service is Initalized successfully";
            Ads_St = true;
         });
    }
////////////////////////////////////////////////////////

When I start Unity I get this error
Unloading broken assembly Assets/GoogleMobileAds/GoogleMobileAds.Unity.dll, this assembly can cause crashes in the runtime

When I build my project and run my game, at the initialization scene where the script is, the logcat outputs the following errors

 AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.ads.initialization.OnInitializationCompleteListener
07-01 22:16:13.221  9719  9739 E Unity   : java.lang.ClassNotFoundException: com.google.android.gms.ads.initialization.OnInitializationCompleteListener
07-01 22:16:13.221  9719  9739 E Unity   :      at java.lang.Class.classForName(Native Method)
07-01 22:16:13.221  9719  9739 E Unity   :      at java.lang.Class.forName(Class.java:454)
07-01 22:16:13.221  9719  9739 E Unity   :      at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
07-01 22:16:13.221  9719  9739 E Unity   :      at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
07-01 22:16:13.221  9719  9739 E Unity   :      at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
07-01 22:16:13.221  9719  9739 E Unity   :      at android.os.Handler.dispatchMessage(Handler.java:102)
07-01 22:16:13.221  9719  9739 E Unity   :      at android.os.Looper.loopOnce(Looper.java:201)
07-01 22:16:13.221  9719  9739 E Unity   :      at android.os.Looper.loop(Looper.java:288)
07-01 22:16:13.221  9719  9739 E Unity   :      at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
07-01 22:16:13.221  9719  9739 E Unity   : Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.initialization.OnInitializationCompleteListener" on path: DexPathList[[zip file "/data/app/~~Bd-NqdABYBlzmZdSPtdakw==/com.Evag.SMX-3Kx-EPExw4mC3jjw_ycqIA==/base.apk"],nativeLibraryDirectories=

Mobile Ads SDK Forum Advisor

unread,
Jul 4, 2022, 12:34:30 AM7/4/22
to lazy...@gmail.com, google-adm...@googlegroups.com
Hi Evangelos,

Thank you for raising this to us.

Would it be possible for your to provide a project (or at least a test project) where the issue is reproducible via Reply privately to author option? This will greatly help us in our investigation.

If the file(s) you are looking to share are less than 25mb in total you can attach them to this case on your next reply. If you are having trouble attaching your file to this case or if your file(s) are larger than 25mb, you can share your files with me by performing the following steps:

1. Navigate to

https://docs.google.com/forms/d/e/1FAIpQLSfkAiXMeYP-fw1W3Z-tT9uwmATEKO5X6S-th0gR2ezdKaaqfg/viewform?usp=pp_url&entry.400550049=Mobile+Ads+SDK&entry.460850823=5004Q00002cFUbwQAG&entry.80707362=00112910

2. Fill out all fields, and attach your file(s).

3. Please reply back on this thread when you have uploaded your file(s). Please do not share this link.

Regards,
Google Logo
Teejay Wennie
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2cFUbw:ref
Message has been deleted

Mobile Ads SDK Forum Advisor

unread,
Jul 19, 2022, 4:52:43 PM7/19/22
to lazy...@gmail.com, google-adm...@googlegroups.com

Hi Evangelos, 

 

Did you try the steps I outlined in the previous email?

I was able to replicate the issue. Here is the fix:

- Delete the GoogleMobileAds plugin. This includes the /Plugin folder and the /GoogleMobileAds folder.
- Install the Ad Placements Beta.
- Do not install any additional plugins. The Ad Placements beta plugin includes all required dependencies.

Hope this helps,

Nick



ref:_00D1U1174p._5004Q2cFUbw:ref
Reply all
Reply to author
Forward
0 new messages