Skip to content

Android crash: Unable to destroy activity / Tried to create view after it has already been destroyed #8035

Open
@ermakov95

Description

@ermakov95

What happened?

Sometimes on Android after the application goes to background - MainActivity is destroyed, then the following crash occurs:

java.lang.RuntimeException: Unable to destroy activity {com.sample.app/com.sample.app.MainActivity}: java.lang.RuntimeException: Tried to create view after it has already been destroyed
    at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5878)
    at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5908)
    at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:190)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:105)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2613)
    at android.os.Handler.dispatchMessage(Handler.java:110)
    at android.os.Looper.loop(Looper.java:219)
    at android.app.ActivityThread.main(ActivityThread.java:8676)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
java.lang.RuntimeException: Tried to create view after it has already been destroyed
    at Wn0.J(SourceFile:32)
    at hb.J(SourceFile:5)
    at Wd0.t(SourceFile:12)
    at Wd0.c(SourceFile:31)
    at nW.h(SourceFile:3)
    at nW.p(SourceFile:13)
    at hb.D0(SourceFile:7)
    at jb.f(SourceFile:28)
    at hb.c0(SourceFile:6)
    at OQ.c0(SourceFile:1)
    at Wn0.w(SourceFile:8)
    at hb.w(SourceFile:23)
    at OQ.w(SourceFile:1)
    at mK.w(SourceFile:4)
    at LJ.onDestroy(SourceFile:8)
    at android.app.Activity.performDestroy(Activity.java:8478)
    at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1355)
    at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5863)
    at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5908)
    at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:190)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:105)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2613)
    at android.os.Handler.dispatchMessage(Handler.java:110)
    at android.os.Looper.loop(Looper.java:219)
    at android.app.ActivityThread.main(ActivityThread.java:8676)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
Image

The problem arose after upgrading RNN version from 7.43 to 7.47

What was the expected behaviour?

No crash

Was it tested on latest react-native-navigation?

  • I have tested this issue on the latest react-native-navigation release and it still reproduces.

Help us reproduce this issue!

No response

In what environment did this happen?

React Native Navigation version: 7.47.0
React Native version: 0.74.7
Has Fabric (React Native's new rendering system) enabled: yes
Node version: v23.10.0
Device model: different, for example POCO X4 Pro 5G, realme 10, Honor 10, Redmi 9 Prime
Android version: from 10 to 15

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions