Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Unity java.lang.NullPointerException: AdUnitId cannot be null.

72 views
Skip to first unread message

Hoàng Huy Dũng

unread,
Oct 8, 2024, 5:12:27 AM10/8/24
to Google Mobile Ads SDK Developers
2024/10/08 14:58:04.038 32639 32639 Error Unity AndroidJavaException: java.lang.NullPointerException: AdUnitId cannot be null.
2024/10/08 14:58:04.038 32639 32639 Error Unity java.lang.NullPointerException: AdUnitId cannot be null.
2024/10/08 14:58:04.038 32639 32639 Error Unity at d2.o.m(com.google.android.gms:play-services-basement@@18.3.0:1)
2024/10/08 14:58:04.038 32639 32639 Error Unity at d2.o.m(com.google.android.gms:play-services-basement@@18.3.0:1)
2024/10/08 14:58:04.038 32639 32639 Error Unity at com.google.unity.ads.Interstitial$1.run(Interstitial.java:1)
2024/10/08 14:58:04.038 32639 32639 Error Unity at android.app.Activity.runOnUiThread(Activity.java:7428)
2024/10/08 14:58:04.038 32639 32639 Error Unity at com.google.unity.ads.Interstitial.loadAd(Interstitial.java:1)
2024/10/08 14:58:04.038 32639 32639 Error Unity at com.unity3d.player.ReflectionHelper.nativeProxyInvoke(Native Method)
2024/10/08 14:58:04.038 32639 32639 Error Unity at com.unity3d.player.ReflectionHelper.c(Unknown Source:0)
2024/10/08 14:58:04.038 32639 32639 Error Unity at com.unity3d.player.ReflectionHelper$a.invoke(Unknown Source:22)
2024/10/08 14:58:04.038 32639 32639 Error Unity at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
2024/10/08 14:58:04.038 32639 32639 Error Unity at $Proxy28.onInitializationComplete(Unknown Source)
2024/10/08 14:58:04.038 32639 32639 Error Unity at com.google.android.gms.ads.internal.client.zzei.zzb(com.google.android.gms:play-services-ads-lite@@23.2.0:8)
2024/10/08 14:58:04.038 32639 32639 Error Unity at com.google.android.gms.internal.ads.q70.L(com.google.android.gms:play-services-ads-l

Mobile Ads SDK Forum Advisor

unread,
Oct 8, 2024, 11:49:32 AM10/8/24
to hacker...@gmail.com, google-adm...@googlegroups.com

Hi,

Thank you for contacting the Mobile Ads SDK Support team.

It is always recommended to use the latest version of SDK. As of today, the latest version of unity is 9.2.1 and Android is 23.4.0

Upon checking the logs, I observed the error you're encountering is a NullPointerException caused by passing a null or empty value for the AdUnitId in the Unity code. This typically happens when the AdUnitId you're using to request or show an ad is either not assigned or is incorrectly referenced. The ad unit ID is a unique ID number assigned to each of your ad units when they're created in AdMob. The ad unit ID is added to your app's code and used to identify ad requests from the ad unit.

Could you kindly verify whether the ad unit ID has been incorporated into your project? 

This message is in relation to case "ref:!00D1U01174p.!5004Q02vGcjg:ref" (ADR-00270941)

Thanks,
 
Google Logo Mobile Ads SDK Team


Hoàng Huy Dũng

unread,
Oct 10, 2024, 5:15:03 AM10/10/24
to Google Mobile Ads SDK Developers
I have already filled in the application ID and advertisement. If I fill it in incorrectly, can you provide me with some instructions so I can verify if it is correct?

Vào lúc 22:49:32 UTC+7 ngày Thứ Ba, 8 tháng 10, 2024, Mobile Ads SDK Forum Advisor đã viết:

Mobile Ads SDK Forum Advisor

unread,
Oct 10, 2024, 2:28:39 PM10/10/24
to hacker...@gmail.com, google-adm...@googlegroups.com

Hi,

Thank you for getting back to us.

Make sure you are using the correct ad unit ID in your code. It should look something like ca-app-pub-xxxxxxxxxxxxxxxx/yyyyyyyyyy. Kindly review the provided document to find your ad unit ID. You can also check the Get started guide for reference. 

If the issue still persists, kindly provide the app ID and ad unit ID (to which you are referring) via reply to author option for further investigation.   

Reply all
Reply to author
Forward
0 new messages