【发布时间】:2022-05-11 18:18:22
【问题描述】:
您好,我正在尝试在我的应用上使用 Admob 广告,但没有显示广告。我收到此错误:
"Code": 3,
"Message": "No ad config.",
"Domain": "com.google.android.gms.ads",
"Cause": "null",
"Response Info": {
"Response ID": "null",
"Mediation Adapter Class Name": "",
"Adapter Responses": []
}
测试 ID 也会出现同样的错误。
这是 gradle 实现:
implementation 'com.google.firebase:firebase-ads:20.3.0'
implementation 'com.google.android.gms:play-services-ads:20.3.0'
我这样初始化广告:
MobileAds.initialize(this);
这是插页式初始化:
adRequest = new AdRequest.Builder().build();
InterstitialAd.load(c,c.getString(R.string.popup), adRequest, new InterstitialAdLoadCallback() {
@Override
public void onAdLoaded(@NonNull InterstitialAd interstitialAd) {
mInterstitialAd = interstitialAd;
}
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
mInterstitialAd = null;
}
});
【问题讨论】:
标签: java android xml admob ads