0

パブリッシャーが提供するカスタム adUnitId を PublisherAdView バナー AD に追加して、Google Mobile Ads SDK をトリガーしてカスタムメイドのイベント ハンドラー クラスを呼び出しますが、代わりに次のエラー メッセージが表示されます。

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() {
    
    }
}

そして、私のアクティビティでは、次のように 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 Mobile Ads SDKドキュメントに従っていました:

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

MyCustomBannerAdapter の呼び出しをトリガーする方法はありますか?

4

1 に答える 1

0

my MyCustomBannerAdapter.

于 2021-03-16T13:49:51.263 に答える