У меня есть приложение, которое я построил для Android TV (API 28), и оно отлично работает на эмуляторе при отладке. Но я построил релизную версию, и при первом запуске приложение вылетело. И после второй попытки запускается нормально. Иногда требуется третья попытка. Итак, я регистрирую код, пока приложение вылетает, и вот результат.
com.iptv - это имя приложения, а PID был 8478.
Process: com.iptv, PID: 8478
08-07 00:51:19.919 8478 8478 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.iptv/com.iptv.MainActivity}: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.swmansion.rnscreens.ScreenFragment: calling Fragment constructor caused an exception
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at android.os.Looper.loop(Looper.java:193)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6669)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: Caused by: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.swmansion.rnscreens.ScreenFragment: calling Fragment constructor caused an exception
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at androidx.fragment.app.Fragment.instantiate(Fragment.java:566)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at androidx.fragment.app.FragmentContainer.instantiate(FragmentContainer.java:57)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at androidx.fragment.app.FragmentManager$3.instantiate(FragmentManager.java:390)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at androidx.fragment.app.FragmentStateManager.<init>(FragmentStateManager.java:74)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at androidx.fragment.app.FragmentManager.restoreSaveState(FragmentManager.java:2454)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at androidx.fragment.app.FragmentController.restoreSaveState(FragmentController.java:196)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:287)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:106)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at com.facebook.react.ReactActivity.onCreate(ReactActivity.java:43)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:7136)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:7127)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: ... 11 more
08-07 00:51:19.919 8478 8478 E AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at java.lang.reflect.Constructor.newInstance0(Native Method)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at androidx.fragment.app.Fragment.instantiate(Fragment.java:548)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: ... 23 more
08-07 00:51:19.919 8478 8478 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Screen fragments should never be restored
08-07 00:51:19.919 8478 8478 E AndroidRuntime: at com.swmansion.rnscreens.ScreenFragment.<init>(ScreenFragment.java:36)
08-07 00:51:19.919 8478 8478 E AndroidRuntime: ... 26 more
08-07 00:51:19.923 3499 7669 W ActivityManager: Force finishing activity com.iptv/.MainActivity
08-07 00:51:19.931 8478 8478 I Process : Sending signal. PID: 8478 SIG: 9
08-07 00:51:19.958 3499 3514 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
08-07 00:51:19.958 3499 3514 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
08-07 00:51:19.990 3219 3219 I Zygote : Process 8478 exited due to signal (9)
08-07 00:51:19.991 3499 7669 I ActivityManager: Process com.iptv (pid 8478) has died: vis +99TOP
08-07 00:51:19.993 3499 3517 W libprocessgroup: kill(-8478, 9) failed: No such process
Я уже прочитал и попробовал это решение . Но он по-прежнему вылетает, и это новый журнал:
Process: com.iptv, PID: 9963
08-07 01:10:27.608 9963 9963 E AndroidRuntime: java.lang.IllegalStateException: Fragment already added: ScreenFragment{25288ab} (83e0bd68-d279-4447-8230-7298073e391b) id=0x55}
08-07 01:10:27.608 9963 9963 E AndroidRuntime: at androidx.fragment.app.FragmentStore.addFragment(FragmentStore.java:67)
08-07 01:10:27.608 9963 9963 E AndroidRuntime: at androidx.fragment.app.FragmentManager.addFragment(FragmentManager.java:1565)
08-07 01:10:27.608 9963 9963 E AndroidRuntime: at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:405)
08-07 01:10:27.608 9963 9963 E AndroidRuntime: at androidx.fragment.app.FragmentManager.executeOps(FragmentManager.java:2169)
08-07 01:10:27.608 9963 9963 E AndroidRuntime: at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1992)
08-07 01:10:27.608 9963 9963 E AndroidRuntime: at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1953)
08-07 01:10:27.608 9963 9963 E AndroidRuntime: at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1849)
08-07 01:10:27.608 9963 9963 E AndroidRuntime: at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:413)
08-07 01:10:27.608 9963 9963 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:873)
08-07 01:10:27.608 9963 9963 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
08-07 01:10:27.608 9963 9963 E AndroidRuntime: at android.os.Looper.loop(Looper.java:193)
08-07 01:10:27.608 9963 9963 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6669)
08-07 01:10:27.608 9963 9963 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
08-07 01:10:27.608 9963 9963 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
08-07 01:10:27.608 9963 9963 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
08-07 01:10:27.614 3499 4044 W ActivityManager: Force finishing activity com.iptv/.MainActivity
08-07 01:10:27.627 9963 9963 I Process : Sending signal. PID: 9963 SIG: 9
08-07 01:10:27.636 3499 3514 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
08-07 01:10:27.636 3499 3514 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
08-07 01:10:27.724 3499 3630 W InputDispatcher: channel 'e4aa437 com.iptv/com.iptv.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
08-07 01:10:27.724 3499 3630 E InputDispatcher: channel 'e4aa437 com.iptv/com.iptv.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
08-07 01:10:27.735 3499 3858 D ConnectivityService: ConnectivityService NetworkRequestInfo binderDied(NetworkRequest [ TRACK_DEFAULT id=51, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Unwanted: Uid: 10072] ], android.os.BinderProxy@22118f5)
08-07 01:10:27.736 3499 3858 I WindowManager: WIN DEATH: Window{e4aa437 u0 com.iptv/com.iptv.MainActivity}
08-07 01:10:27.736 3499 3858 W InputDispatcher: Attempted to unregister already unregistered input channel 'e4aa437 com.iptv/com.iptv.MainActivity (server)'
08-07 01:10:27.737 3499 3722 D ConnectivityService: releasing NetworkRequest [ TRACK_DEFAULT id=51, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Unwanted: Uid: 10072] ] (release request)
08-07 01:10:27.738 3219 3219 I Zygote : Process 9963 exited due to signal (9)
08-07 01:10:27.738 3499 3870 I ActivityManager: Process com.iptv (pid 9963) has died: vis TOP
08-07 01:10:27.739 3499 3517 W libprocessgroup: kill(-9963, 9) failed: No such process
Здесь я застрял. Я не уверен, где я сейчас нахожусь с этим. Заранее спасибо!