问题
I works on integrating ads. But unfortunently When I update sdk to 6.2.0 Ads not loaded (No message appears) But on same code i change sdk to 5.+, Ads loaded and shown
implementation 'com.facebook.android:audience-network-sdk:6.2.0' [Not loaded]
implementation 'com.facebook.android:audience-network-sdk:5.+' [Loaded and shown]
adView = new AdView(this, MainActivity.this.getString(R.string.facebook_banner_id), AdSize.BANNER_HEIGHT_50);
// Find the Ad Container
LinearLayout adContainer = (LinearLayout) findViewById(R.id.banner_container);
// Add the ad view to your activity layout
adContainer.addView(adView);
// Request an ad
adView.loadAd();
//AdUtils.showFBInterstitialads(MainActivity.this);
AdListener adListener = new AdListener() {
@Override
public void onError(Ad ad, AdError adError) {
// Ad error callback
Toast.makeText(
MainActivity.this,
"Error: " + adError.getErrorMessage(),
Toast.LENGTH_LONG)
.show();
Log.i("Adloaded", "error" + adError.getErrorMessage());
}
@Override
public void onAdLoaded(Ad ad) {
Log.i("Adloaded", "loaded");
}
@Override
public void onAdClicked(Ad ad) {
// Ad clicked callback
}
@Override
public void onLoggingImpression(Ad ad) {
// Ad impression logged callback
}
};
// Request an ad
adView.loadAd(adView.buildLoadAdConfig().withAdListener(adListener).build());
** The android app has already with 5.+ sdk. But as now facebook says to "Update your sdk to latest". So I change sdk "5.+" to "6.2.0" but Nothing to appear. When I go back and change sdk 5.+ again Ads loaded and shown**
来源:https://stackoverflow.com/questions/64962584/fb-ads-not-loaded-when-i-update-fan-to-6-2-0-but-ad-loaded-shown-on-5-sdk-wi