空格代替广告-ADMOB

时间:2018-10-28 20:44:11

标签: android admob ads

我在Android Studio中设置了Admob广告,但是没有要渲染的广告,只有它的空间,我进行了以下设置:

AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<application>

<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="ca-app-pub-5057129995616294~7653608710"/>

</application>

app / build.gradle

implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-ads:17.0.0'
}
apply plugin: 'com.google.gms.google-services'

BaseActivity

import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.MobileAds;



public abstract class BaseActivity extends AppCompatActivity {
private AdView mAdView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.sticker_pack_details);
    MobileAds.initialize(this, "ca-app-pub-5057129995616294~7653608710");


    mAdView = findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);
}

Layout_sticker_pack_details.xml

<com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:id="@+id/adView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:visibility="visible"
    ads:adSize="BANNER"
    ads:adUnitId="@string/banner_ad_unit_id"></com.google.android.gms.ads.AdView></LinearLayout>

Strings.xml

<string name="banner_ad_unit_id">ca-app-pub-5057129995616294/7653608710</string>

当我运行该应用程序时,该广告没有显示,并且该构建没有显示错误,那可能是什么?我知道,当您将BANNER更改为MEDIUM_RECTANGLE时,应用程序中的大小也会更改

Print的图片

1 个答案:

答案 0 :(得分:0)

@put("/submit/<val>")
def submit(val):
    return "Yay it worked!"