Errors occurred while debugging with ADB logcat. Unity app. PLAESE HELP. I Spent 1 month to fix this bug, but it didn't help me...

73 views
Skip to first unread message

NIKita

unread,
Jul 21, 2021, 7:31:34 AM7/21/21
to Google Mobile Ads SDK Developers
Hello. There is a problem with google AdMob. Test ads are shown in the editor (There are no errors in the editor), but real ads are not showing on my phone. Then I decided to use USB debugging and found out that the following error occurs:
"NullReferenceException: Object reference not set to an instance of an object. at GoogleMobileAds.Api.MobileAds.Initialize (System.Action`1[T] initCompleteAction) [0x00000] in :0 at Show_ads.Start () [0x00000] in :0"

Here's my script:


  1. using GoogleMobileAds.Api; 
  2. using System.Collections; 
  3. using System; 
  4. using UnityEngine.Scripting; 
  5. [assembly: Preserve]
  6. public class Show_ads : MonoBehaviour
  7.  { 
  8.     //ADS---------------------------- 
  9.     private RewardedAd rewardedAd; 
  10.     private const string RewardedID = "id"; 
  11.     //ADS----------------------------void Start()
  12.       void Start()
  13.       {
  14.         MobileAds.Initialize(initStatus => { });
  15.         LoadRewardedAD();
  16.     }

  17.       private void LoadRewardedAD()
  18.       {
  19.         //load-ad
  20.         rewardedAd = new RewardedAd(RewardedID);
  21.         AdRequest adRequest = new AdRequest.Builder().Build();
  22.         rewardedAd.LoadAd(adRequest);

  23.         rewardedAd.OnUserEarnedReward += HandleUserEarnedReward;
  24.     }
  25.       //Called from another script
  26.       public void ShowRewardedAD()
  27.       {
  28.         if (rewardedAd.IsLoaded())
  29.         {
  30.             rewardedAd.Show();
  31.         }
  32.     }
  33.       public void HandleUserEarnedReward(object sender, Reward args)
  34.       {
  35.         if (Reward_type == 0)
  36.         {
  37.             //gem
  38.         }
  39.         else if (Reward_type == 1)
  40.         {
  41.             //coin

  42.         }
  43.         else if (Reward_type == 2)
  44.         {
  45.             //Respawn

  46.         }
  47.     }

  48.       private IEnumerator WaitAD()
  49.       {
  50.         yield return new WaitForSeconds(3);
  51.         LoadRewardedAD();
  52.       }
  53. }
Please HELP!!!!

Mobile Ads SDK Forum Advisor

unread,
Jul 21, 2021, 1:38:59 PM7/21/21
to seim...@gmail.com, google-adm...@googlegroups.com
Hi NIKita,

Thank you for reaching out to us. I know that you have brought this issue to our attention before, as shown here. Also as stated in the other post. I have brought this to our team to look into. Which at the moment we have not yet gotten anything back on.

Regards,
Google Logo
William Pescherine
Mobile Ads SDK Team
 


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