AppLovin / AppLovin-MAX-SDK-Android

Other
233 stars 104 forks source link

AppLovin Facebook Mediation Crash #130

Closed tfkci closed 2 years ago

tfkci commented 2 years ago
    implementation("com.applovin.mediation:facebook-adapter:6.8.0.7")

     java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference
        at com.facebook.ads.internal.util.common.ANActivityLifecycleCallbacksListener.registerActivityCallbacks(ANActivityLifecycleCallbacksListener.java:70)
        at com.facebook.ads.internal.dynamicloading.DynamicLoaderFactory$1.run(DynamicLoaderFactory.java:95)
        at java.lang.Thread.run(Thread.java:923)

After integrating applovin facebook mediation adapter, started to face this error

NanaAmoah commented 2 years ago

Hi @tfkci, can you share when this happens ? For example, does this happen when you start the app when we try to initialize Facebook's SDK? Or when you try to load or show an ad? If yes, does this happen with a specific ad format?

akshatsingh93 commented 2 years ago

Hi,

This is happening on latest SDK version 11.0.1 and causing crash when we have killed the app. i.e when the app is in background.


Failed to initialize 3rd-party SDKs. Please make sure to initialize the AppLovin SDK with an Activity context.

Attempting to init 3rd-party SDKs without an Activity instance. Please make sure to update the top Activity using `updateActivity().
2022-02-02 15:21:14.921 23742-23975/com.appname E/AndroidRuntime: FATAL EXCEPTION: Thread-14
    Process: com.appname, PID: 23742
    java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference
        at com.facebook.ads.internal.util.common.ANActivityLifecycleCallbacksListener.registerActivityCallbacks(SourceFile:70)
        at com.facebook.ads.internal.dynamicloading.DynamicLoaderFactory$a.run(SourceFile:95)
        at java.lang.Thread.run(Thread.java:923)
thomasmso commented 2 years ago

@tfkci / @akshatsingh93 - What SDK version are you on? v11.1.0?

tfkci commented 2 years ago

Yes, it is v11.1.0. The crash is hard to localize. Even though we initialize the SDK with the activity context,

Failed to initialize 3rd-party SDKs. Please make sure to initialize the AppLovin SDK with an Activity context.

While the app is in the background, it crashes always. The crash occurs for the activity include native ad implementation ( we don't have any clue if the bug is related to the ad unit)

Firebase

image
thomasmso commented 2 years ago

Are you able to reproduce this crash locally?

thomasmso commented 2 years ago

@tfkci / @akshatsingh93 - Pushed our Facebook adapter v6.8.0.8, can you check if it's fixed?

tfkci commented 2 years ago

I can't reproduce the issue for now. Updating now, will share results.

tfkci commented 2 years ago

The issue is resolved with v6.8.0.8.

NiaNingXue commented 2 years ago

I am using the Facebook adapter v6.8.0.8, but still have the issue. when the application created, I initialize the AppLovin SDK, but if no activity show at the same time, it will crash

thomasmso commented 2 years ago

@NiaNingXue - Could you provide full stack trace? And what AppLovin MAX SDK version are you on?

waqas-334 commented 2 years ago

Did you also include the Facebook SDK or the adapter will do it automatically?

chauduyphanvu commented 2 years ago

@waqas-334, mediation SDKs are fetched transitively via the adapters. Facebook example: https://github.com/AppLovin/AppLovin-MAX-SDK-Android/blob/master/Facebook/build.gradle.kts#L50-L57.

kruguerjo commented 2 years ago
    implementation("com.applovin.mediation:facebook-adapter:6.8.0.7")

     java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference
        at com.facebook.ads.internal.util.common.ANActivityLifecycleCallbacksListener.registerActivityCallbacks(ANActivityLifecycleCallbacksListener.java:70)
        at com.facebook.ads.internal.dynamicloading.DynamicLoaderFactory$1.run(DynamicLoaderFactory.java:95)
        at java.lang.Thread.run(Thread.java:923)

After integrating applovin facebook mediation adapter, started to face this error

I'm having the same issue:

com.facebook.ads.internal.util.common.ANActivityLifecycleCallbacksListener.registerActivityCallbacks (ANActivityLifecycleCallbacksListener.java:70) at com.facebook.ads.internal.dynamicloading.DynamicLoaderFactory$1.run (DynamicLoaderFactory.java:95) at java.lang.Thread.run (Thread.java:929)

santoshbagadi commented 2 years ago

Hi @kruguerjo , what version of Facebook Mediation adapter are you using? The issue should be fixed in v6.8.0.8 of our Facebook Mediation adapter.

Are you able to reproduce the issue locally, if so, could you please provide verbose logs of the full session when the issue is happening