AdMob 仅显示测试广告,这是 Activity 上的代码:
<com.google.android.gms.ads.AdView
ads:adUnitId="ca-app-pub-869XXXXXXXXXXX50/209XXXXX42"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/anuncio2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
android:layout_alignParentBottom="true"
android:layout_alignLeft="@+id/anuncio1"
android:layout_alignStart="@+id/anuncio1">
</com.google.android.gms.ads.AdView>
此 Java 代码启用广告:
MobileAds.initialize(this,"ca-app-pub-XXXXXXXXXXXXXXXX~XXXXXXXXXX");
runOnUiThread(new Runnable(){
@Override
public void run(){
for(int id: Arrays.asList(R.id.anuncio1,R.id.anuncio2))((AdView)findViewById(id)).loadAd(new AdRequest.Builder().build());
}
});
这是我的 AndroidMainfest.xml:https ://pastebin.com/LgMBmYNW
这是我的模块应用程序的 build.gradle:https ://pastebin.com/gQUiYVrj
问候。