Facebook Audience Network null object reference when creating banner

Hello,

I am trying to implement Facebook Audience Network to my unity project. When I try sample scenes that is provided by sdk, I get an null object reference error.

NullReferenceException: Object reference not set to an instance of an object
AudienceNetwork.AdViewBridgeAndroid.Create (System.String placementId, AudienceNetwork.AdView adView, AudienceNetwork.AdSize size) (at Assets/AudienceNetwork/Library/AdView.cs:470)
AudienceNetwork.AdView..ctor (System.String placementId, AudienceNetwork.AdSize size) (at Assets/AudienceNetwork/Library/AdView.cs:117)
AdViewScene.LoadBanner () (at Assets/AudienceNetwork/Scenes/Banner/AdViewScene.cs:39)

I looked at the line of error and as I understand, object of AndroidJaveObject class can’t be instantiated.

 public override int Create(string placementId,
                                   AdView adView,
                                   AdSize size)
        {
            AdUtility.prepare();
            AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
            if(currentActivity==null){
                //CURRENT ACTIVITY IS THE VARIABLE THAT CAUSES ERROR WHILE IT IS NULL
                Debug.LogError("No current activity");                
   
            }
            AndroidJavaObject context = currentActivity.Call<AndroidJavaObject>("getApplicationContext");

            AndroidJavaObject bridgedAdView = new AndroidJavaObject("com.facebook.ads.AdView",
                    context,
                    placementId,
                    javaAdSizeFromAdSize(size));

            AdViewBridgeListenerProxy proxy = new AdViewBridgeListenerProxy(adView, bridgedAdView);
            bridgedAdView.Call("setAdListener", proxy);

            AdViewContainer adViewContainer = new AdViewContainer(adView);
            adViewContainer.bridgedAdView = bridgedAdView;
            adViewContainer.listenerProxy = proxy;

            int key = AdViewBridgeAndroid.lastKey;
            AdViewBridgeAndroid.adViews.Add(key, adViewContainer);
            AdViewBridgeAndroid.lastKey++;
            return key;
        }

Maybe I am missing initialization of a facebook service, but I followed documentation completely.

Do you have any idea about the cause of this error?

Did you manage to solve this issue ?,Did you manage to solve that issue ??

Similar question. I got this when I click Load Interstitial

NullReferenceException: Object reference not set to an instance of an object
AudienceNetwork.AudienceNetworkAds.IsInitialized () (at Assets/AudienceNetwork/Library/AudienceNetworkAds.cs:34)
AudienceNetwork.AudienceNetworkAds.Initialize () (at Assets/AudienceNetwork/Library/AudienceNetworkAds.cs:15)
InterstitialAdScene.Awake () (at Assets/AudienceNetwork/Scenes/Interstitial/InterstitialAdScene.cs:23)

Same Problem And not finding solution :frowning: