I have this in my main xml file:
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="******************"
ads:adSize="BANNER"
android:id="@+id/adView"/>
I have already set the ad size and unit id, but when this is run (from MainActivity.java),
AdView adView = (AdView)this.findViewById(com.example.lovetestactual.R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
It threw an exception of what is in the title.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…