AppLovin / AppLovin-MAX-SDK-Android

Other
227 stars 102 forks source link

[MediationAdapterWrapper] Failed operation destroy for FACEBOOK_NATIVE_BIDDING android.view.ViewRootImpl$CalledFromWrongThreadException #723

Open ashakirov opened 1 week ago

ashakirov commented 1 week ago

MAX SDK Version

13.0.0

Device/Platform Info

android 14

Current Behavior

I'm not sure where should I report this bug but there is problem with native banner destroying process in facebook adapter 6.18.0.0 (or maybe bug is in MAX sdk v13.0.0). As far as I understand facebook adapter (or max sdk) is trying to destroy views in wrong thread (thread must be main).

This bug is very similar to this issue This bug does not exist in facebook adapter 6.17.0.1

Here is full stacktrace:

17:00:07.452 AppLovinSdk E [MediationAdapterWrapper] Failed operation destroy for FACEBOOK_NATIVE_BIDDING android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. Expected: main Calling: AppLovinSdk:shared_thread_pool at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:9994) at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:2082) at android.view.View.requestLayout(View.java:27043) at android.view.View.requestLayout(View.java:27043) at android.view.View.requestLayout(View.java:27043) at android.view.View.requestLayout(View.java:27043) at android.view.View.requestLayout(View.java:27043) at android.view.View.requestLayout(View.java:27043) at android.view.View.requestLayout(View.java:27043) at android.view.View.requestLayout(View.java:27043) at android.view.View.requestLayout(View.java:27043) at androidx.constraintlayout.widget.ConstraintLayout.requestLayout(ConstraintLayout.java:3146) at android.view.View.requestLayout(View.java:27043) at android.view.View.requestLayout(View.java:27043) at android.view.ViewGroup.removeView(ViewGroup.java:5503) at com.facebook.ads.redexgen.X.W7.unregisterView(:59738) at com.facebook.ads.NativeAdBase.unregisterView(NativeAdBase.java:560) at com.applovin.mediation.adapters.FacebookMediationAdapter.onDestroy(FacebookMediationAdapter.java:192) at com.applovin.impl.mediation.g$b.run(SourceFile:1) at com.applovin.impl.mediation.g.l(SourceFile:26) at com.applovin.impl.mediation.g.$r8$lambda$M0-41Qz0EJAwuzvMp176QgZnzQA(Unknown Source:0) at com.applovin.impl.mediation.g$$ExternalSyntheticLambda12.run(D8$$SyntheticClass:0) at com.applovin.impl.mediation.g.a(SourceFile:5935) at com.applovin.impl.mediation.g.$r8$lambda$Bzit5t9eqfA6lP9x96YlsSo49TU(Unknown Source:0) at com.applovin.impl.mediation.g$$ExternalSyntheticLambda10.run(D8$$SyntheticClass:0) at com.applovin.impl.jn.run(SourceFile:46) at com.applovin.impl.tm$d.run(SourceFile:24) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487) at java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) at java.lang.Thread.run(Thread.java:1012)

Here is screenshot from debugger: Screenshot_31

Expected Behavior

No response

How to Reproduce

  1. MAX SDK Version 13.0.0
  2. facebook (meta) adapter 6.18.0.0
  3. load facebook native banner via MaxNativeAdLoader.loadAd method
  4. destroy native banner via calling MaxNativeAdLoader.destroy (call it from main thread).

Reproducible in the demo app?

Yes

Additional Info

No response

maximilianbuck commented 1 week ago

Hi @ashakirov, We are aware of this issue and had a fix in 13.0.0 (as per the other issue) but we found that in a very limited edge case it lead to a crash so that fix is not enabled at the moment. We are working to fix that case and will release a new SDK version (13.0.1 presumably) with it. I'll let you know when that happens.