Ad Size and Ad unit id must be set before loadAd is called

后端 未结 8 1467
后悔当初
后悔当初 2020-12-03 00:52

I have this in my main xml file:



        
8条回答
  •  不思量自难忘°
    2020-12-03 01:22

    I faced that same problem because i do not add this line on xmlns:ads="http://schemas.android.com/apk/res-auto" top of . Then i change my xml code like this

        
    
    

    after that i add this 3 line in onCreate method

    AdView mAdView = (AdView)findViewById(R.id.adView);
        MobileAds.initialize(this, "ca-app-pub-3940256099942544~3347511713");
        AdRequest adRequest = new AdRequest.Builder().build();
        mAdView.loadAd(adRequest);
    

提交回复
热议问题