4

I recently update my app's facebook audience sdk to the latest one and always getting a crash because of onLoggingImpression which is a new method in AdListener the below is the stack trace i get. I am using custom admob facebook adapter here.

*

java.lang.AbstractMethodError: abstract method "void com.facebook.ads.AdListener.onLoggingImpression(com.facebook.ads.Ad)"
                                                                           at com.facebook.ads.InterstitialAd$1.b(Unknown Source)   
                                                                           at com.facebook.ads.internal.DisplayAdController$11.onInterstitialLoggingImpression(Unknown Source)
                                                                           at com.facebook.ads.internal.adapters.s.onReceive(Unknown Source)
                                                                           at android.support.v4.b.g.a(LocalBroadcastManager.java:297)
                                                                           at android.support.v4.b.g.a(LocalBroadcastManager.java:46)
                                                                           at android.support.v4.b.g$1.handleMessage(LocalBroadcastManager.java:116)
                                                                           at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                           at android.os.Looper.loop(Looper.java:154)
                                                                           at android.app.ActivityThread.main(ActivityThread.java:6123)
                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)

*

Mohamed_AbdAllah
  • 5,311
  • 3
  • 28
  • 47
1shubhamjoshi1
  • 546
  • 7
  • 16

3 Answers3

4

Thanks to @Adomas, the problem should be the Facebook adapter.

Here's newest integration guide. https://developers.google.com/admob/android/mediation/facebook

Now we don't need to download the adapter manually.

compile 'com.facebook.android:audience-network-sdk:4.25.0'
compile 'com.google.ads.mediation:facebook:4.25.0.0'

But I'm using 4.23.0, because the 4.25.0 shows some warnings after I build my project.

Kimi Chiu
  • 2,103
  • 3
  • 22
  • 37
  • Thanks marked as accepted, although I tried this earlier the issue was I had a local jar file added already inside my projects libs folder. Just removed it and kudos. – 1shubhamjoshi1 Sep 26 '17 at 08:59
2

Most likely you need to update Admob SDK or admob adapter for Facebook audience network.

This issue happened for me after I rebuilt my project after few months of not touching it, therefore after gradle sync the newest version of FAN SDK was downloaded. Since I am using One by AOL to mediate to FAN, I have updated it's SDK and adapter for FAN to the newest versions and the app stopped crashing - error is not occurring anymore. Therefore it might be the same case with AdMob - newer SDK or adapter version needs to be added so that Facebook ads would work.

Adomas
  • 466
  • 1
  • 8
  • 21
1

I ran into this same issue in the past few days when updating to Facebook Audience Network (FAN) SDK 4.25.0. Interstitials work great, but banners give this crash.

The reason for this is that Facebook Audience Network's com.facebook.ads.AdListener class added an additional callback function -- onLoggingImpression. The AudienceNetwork.jar assumes that whatever whatever code is handling the ads -- MoPub's custom event adapter in this case -- will handle ALL the callback functions it defines.

So in this case, the Facebook custom event adapter simply needs to be updated.

MoPub provides the code for this on Github here: Mopub Android SDK. The file you want is FacebookBanner.java.

If you are compiling your project directly as an Android project, you can just take the FacebookBanner.java file directly from that MoPub download and replace your existing one with it.

However, if you are using Unity, like many people are, you will need to do additional work to turn this into a .jar file. This is a bit more involved, so I've uploaded a bitbucket project here.

To use the bitbucket project, click the link and download it, then follow the README instructions, which are included in the download as well as on the Overview page on bitbucket. The instructions to build for MacOS are as follows:

  1. Open a command line (terminal) and navigate to the project folder.
  2. Run the "go" script by typing "./go"
  3. Copy FacebookBanner.jar into your Unity project in the Assets/Plugins/Android folder.
  4. Rebuild your Unity project.

If you want to do things the "right" way, you should download the FacebookBanner.java and place it in the folder com/mopub/mobileads/ in the project downloaded. I already have it in the project, but that is how you could update it.

If you aren't on MacOS you can just grab the FacebookBanner.jar file, which is also included in the bitbucket project.

If you don't want to do the work and just want the two downloads, here they are:

FacebookBanner.java

FacebookBanner.jar

Obviously those will get outdated, but now you've got the full solution. :)

Good luck!

drewster
  • 5,460
  • 5
  • 40
  • 50