Google 广告中介的自定义事件未调用已定义的收益合作伙伴 class - CustomEventAdapter

Custom Event for Google Ads Mediation not calling yield partner defined class - CustomEventAdapter

我将自定义 adUnitId 添加到我的 PublisherAdView 横幅广告,由发布商提供,以触发 Google 移动广告 SDK 调用我的自定义事件处理程序 class,但我收到此错误留言:

Ads: Could not load custom event implementation class: MyCustomBannerAdapter, assuming old implementation.
Ads: Could not instantiate mediation adapter: com.google.ads.mediation.customevent.CustomEventAdapter. 
java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.Map.get(java.lang.Object)' on a null object reference
        at com.google.android.gms.internal.ads.zzamo.zzdk(com.google.android.gms:play-services-ads-lite@@19.2.0:39)
        at com.google.android.gms.internal.ads.zzamo.zzdj(com.google.android.gms:play-services-ads-lite@@19.2.0:28)
        at com.google.android.gms.internal.ads.zzamo.zzdh(com.google.android.gms:play-services-ads-lite@@19.2.0:2)
        at com.google.android.gms.internal.ads.zzcix.zze(com.google.android.gms:play-services-ads@@19.2.0:31)
        at com.google.android.gms.internal.ads.zzcix.zzd(com.google.android.gms:play-services-ads@@19.2.0:14)
        at com.google.android.gms.internal.ads.zzcsv.zzf(com.google.android.gms:play-services-ads@@19.2.0:4)
        at com.google.android.gms.internal.ads.zzcve.zzb(com.google.android.gms:play-services-ads@@19.2.0:10)
        at com.google.android.gms.internal.ads.zzctz.zza(com.google.android.gms:play-services-ads@@19.2.0:34)
        at com.google.android.gms.internal.ads.zzcty.zzf(Unknown Source:10)
        at com.google.android.gms.internal.ads.zzdts.zza(com.google.android.gms:play-services-ads@@19.2.0:7)
        at com.google.android.gms.internal.ads.zzdtt.run(com.google.android.gms:play-services-ads@@19.2.0:41)
        at com.google.android.gms.internal.ads.zzdvj.run(com.google.android.gms:play-services-ads@@19.2.0:3)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)

这是 MyCustomBannerAdapter:

public final class MyCustomBannerAdapter extends Adapter implements CustomEventBanner, CustomEventInterstitial {

    @Override
    public void initialize(Context context, InitializationCompleteCallback 
    initializationCompleteCallback, List<MediationConfiguration> list) {
    
    }

    @Override
    public VersionInfo getVersionInfo() {
        return null;
    }

    @Override
    public VersionInfo getSDKVersionInfo() {
        return null;
    }

    @Override
    public void requestBannerAd(Context context, CustomEventBannerListener customEventBannerListener, 
    String s, AdSize adSize, MediationAdRequest mediationAdRequest, Bundle bundle) {

    }

    @Override
    public void onDestroy() {
        
    }

    @Override
    public void onPause() {
        
    }

    @Override
    public void onResume() {
        
    }

    @Override
    public void requestInterstitialAd(Context context, CustomEventInterstitialListener 
    customEventInterstitialListener, String s, MediationAdRequest mediationAdRequest, Bundle bundle){
    
    }

    @Override
    public void showInterstitial() {
    
    }
}

在我的 activity 中,我 导入了 MyCustomBannerAdapter,如下所示:

import com.example.event.adapter.MyCustomBannerAdapter 

构建 gradle:

implementation 'com.google.android.gms:play-services-ads:19.0.0'

AndroidManifest:

<meta-data
    android:name="com.google.android.gms.ads.AD_MANAGER_APP"
    android:value="true" />

我正在关注官方的 Google 移动广告 SDK 文档

https://developers.google.com/ad-manager/mobile-ads-sdk/android/quick-start

知道如何触发调用 MyCustomBannerAdapter 吗?

发现广告有后备数据,用于通过反射调用我的MyCustomBannerAdapter

触发机制