Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalStateException: Failed to load new ad - this instance is already destroyed #589

Open
inidamleader opened this issue Nov 27, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@inidamleader
Copy link

MAX SDK Version

12.0.0

Device/Platform Info

All android verion

Current Behavior

Crash on activity resume:

Fatal Exception: java.lang.RuntimeException: Unable to resume activity {com.inidamleader.ovtracker/com.inidamleader.ovtracker.layer.ui.main.MainActivity}: java.lang.IllegalStateException: Failed to load new ad - this instance is already destroyed for ad unit ID: 6fb9cee1b6057600
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4034)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4066)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1969)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7127)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)

Caused by java.lang.IllegalStateException: Failed to load new ad - this instance is already destroyed for ad unit ID: 6fb9cee1b6057600
at com.applovin.impl.mediation.ads.MaxAdViewImpl.a(SourceFile:252)
at com.applovin.impl.mediation.ads.MaxAdViewImpl.loadAd(SourceFile:240)
at com.applovin.impl.mediation.ads.MaxAdViewImpl.onAdRefresh(SourceFile:649)
at com.applovin.impl.sdk.e.AA(SourceFile:297)
at com.applovin.impl.sdk.e.onReceive(SourceFile:228)
at com.applovin.impl.sdk.AppLovinBroadcastManager.sendBroadcastSync(SourceFile:232)
at com.applovin.impl.sdk.SessionTracker.Ft(SourceFile:219)
at com.applovin.impl.sdk.SessionTracker.AA(SourceFile:159)
at com.applovin.impl.sdk.SessionTracker.a(SourceFile:29)
at com.applovin.impl.sdk.SessionTracker$1.onActivityResumed(SourceFile:69)
at android.app.Application.dispatchActivityResumed(Application.java:264)
at android.app.Activity.onResume(Activity.java:1403)
at androidx.fragment.app.FragmentActivity.onResume(FragmentActivity.java:310)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1416)
at android.app.Activity.performResume(Activity.java:7585)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4026)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4066)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1969)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7127)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)

Expected Behavior

Not to crash

How to Reproduce

Not reproducible

Additional Info

Screenshot 2023-11-27 at 10-03-43 OvTracker - com applovin impl mediation ads MaxAdViewImpl a - Firebase console

@inidamleader inidamleader added the bug Something isn't working label Nov 27, 2023
@Str4tos
Copy link

Str4tos commented Nov 27, 2023

Duplicate issue: #583

@inidamleader
Copy link
Author

It seems that either: 1- MaxAd Banner view use pattern singleton for creation which return the same instance after configuration change. 2- Or even after calling destroy on a MaxAd, this one keep refreshing and loading new content while it is already destroyed.
Using a flag to check if destroy is called does not work because this is an intern error related to refreshing.

I think that there is a workaound that reduce considerably the number of crashes: It consists of stopping the auto refreshing just before the destruction:

    override fun destroy() {
        maxAdView?.stopAutoRefresh()
        maxAdView?.destroy()
        super.destroy()
    }

@clee2005
Copy link

clee2005 commented Nov 30, 2023

I'm seeing a very similar crash in our apps as well with only this SDK version. The only difference I can think of is that we are now showing the GDPR form which I believe will cause the app to Pause and then Resume which this exception seems to indicate. We are getting more and more of these exceptions driving our crash rate up above the acceptable threshold.

Exception java.lang.RuntimeException:
at android.app.ActivityThread.performResumeActivity (ActivityThread.java:4987)
at android.app.ActivityThread.handleResumeActivity (ActivityThread.java:5020)
at android.app.servertransaction.ResumeActivityItem.execute (ResumeActivityItem.java:54)
at android.app.servertransaction.ActivityTransactionItem.execute (ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2394)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loopOnce (Looper.java:211)
at android.os.Looper.loop (Looper.java:300)
at android.app.ActivityThread.main (ActivityThread.java:8289)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:559)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:954)
Caused by java.lang.IllegalStateException:
at com.applovin.impl.mediation.ads.MaxAdViewImpl.a (SourceFile:252)
at com.applovin.impl.mediation.ads.MaxAdViewImpl.loadAd (SourceFile:240)
at com.applovin.impl.mediation.ads.MaxAdViewImpl.onAdRefresh (SourceFile:649)
at com.applovin.impl.sdk.e.AA (SourceFile:297)
at com.applovin.impl.sdk.e.onReceive (SourceFile:228)
at com.applovin.impl.sdk.AppLovinBroadcastManager.sendBroadcastSync (SourceFile:232)
at com.applovin.impl.sdk.SessionTracker.Ft (SourceFile:219)
at com.applovin.impl.sdk.SessionTracker.AA (SourceFile:159)
at com.applovin.impl.sdk.SessionTracker.a (SourceFile:29)
at com.applovin.impl.sdk.SessionTracker$1.onActivityResumed (SourceFile:69)
at android.app.Application.dispatchActivityResumed (Application.java:440)
at android.app.Activity.dispatchActivityResumed (Activity.java:1511)
at android.app.Activity.onResume (Activity.java:2093)
at androidx.fragment.app.FragmentActivity.onResume (FragmentActivity.java:434)
at com.donkeysoft.wordwowfree.RunnerActivity.onResume (RunnerActivity.java:1084)
at android.app.Instrumentation.callActivityOnResume (Instrumentation.java:1585)
at android.app.Activity.performResume (Activity.java:8674)
at android.app.ActivityThread.performResumeActivity (ActivityThread.java:4977)

@AviNLeung
Copy link
Contributor

We are currently fixing the error related to ad refresh on pause/resume.

We made a server side change on November 28 so that the crash only happens in debug builds, so it should not be affecting external traffic anymore.

@clee2005
Copy link

clee2005 commented Nov 30, 2023 via email

@AviNLeung
Copy link
Contributor

I am unable to see the email link from Google Play, but please let me know if the issue persists on release builds.

@clee2005
Copy link

clee2005 commented Dec 1, 2023 via email

@AviNLeung
Copy link
Contributor

FYI, we released a fix for this issue today in our newest SDK version 12.1.0(https://support.applovin.com/hc/en-us/articles/13887934767117-Changelog).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants