应用程序在电视盒中启动时退出

App exits while launching in TV Box

错误如下所示。

ANR in com.xxxxxxxx.xxxxxxxx.android (com.xxxxxxxx.xxxxxxxx.android/com.xxxxxxxx.xxxxxxxx.splashpage.SplashActivity)
PID: 7892
Reason: Input dispatching timed out (Waiting because no window has focus but there is a focused application that may eventually add a window when it finishes starting up.)
Load: 0.66 / 0.81 / 0.76
CPU usage from 4152ms to -4853ms ago:
 20% 3111/system_server: 7.7% user + 13% kernel / faults: 4972 minor 2 major
 0% 2789/debuggerd: 0% user + 0% kernel / faults: 3092 minor 2 major
 0.1% 3932/com.google.android.googlequicksearchbox:search: 0% user + 0.1% kernel / faults: 884 minor
 2.1% 7892/com.cinesoft.cinehome.android: 0.6% user + 1.4% kernel / faults: 2854 minor
 0.8% 3288/com.android.systemui: 0.3% user + 0.5% kernel / faults: 1209 minor
 0.9% 2763/logd: 0.8% user + 0.1% kernel / faults: 3 minor
 0% 3409/com.droidlogic.inputmethod.remote: 0% user + 0% kernel / faults: 935 minor
 0% 3427/com.droidlogic.service.remotecontrol: 0% user + 0% kernel / faults: 935 minor
 0% 3447/com.droidlogic.SubTitleService: 0% user + 0% kernel / faults: 932 minor
 0.6% 7495/kworker/0:2: 0% user + 0.6% kernel
 0.4% 2791/mediaserver: 0.1% user + 0.3% kernel / faults: 1 minor
 0.3% 1842/mmcqd/0: 0% user + 0.3% kernel
 0.2% 7/rcu_preempt: 0% user + 0.2% kernel
 0.2% 3468/com.droidlogic.mboxlauncher: 0.2% user + 0% kernel / faults: 641 minor
 0% 896/kworker/2:1: 0% user + 0% kernel
 0.1% 1722/kthread_h265: 0% user + 0.1% kernel
 0.1% 3868/adbd: 0% user + 0.1% kernel
 0% 4034/usbtestpm: 0% user + 0% kernel / faults: 127 minor
+0% 8015/dex2oat: 0% user + 0% kernel
68% TOTAL: 52% user + 12% kernel + 3.7% iowait
CPU usage from 4120ms to 4634ms later:
 5.7% 7892/com.cinesoft.cinehome.android: 0% user + 5.7% kernel / faults: 260 minor
   5.7% 7892/inehome.android: 0% user + 5.7% kernel
 2.8% 2763/logd: 1.4% user + 1.4% kernel / faults: 1 minor
   2.8% 5820/logd.reader.per: 2.8% user + 0% kernel
 3.8% 3111/system_server: 1.9% user + 1.9% kernel / faults: 2 minor
   1.9% 3123/FinalizerDaemon: 1.9% user + 0% kernel
   1.9% 3127/Binder_1: 0% user + 1.9% kernel
   1.9% 3130/ActivityManager: 0% user + 1.9% kernel
 1.5% 3932/com.google.android.googlequicksearchbox:search: 1.5% user + 0% kernel
 1.6% 7495/kworker/0:2: 0% user + 1.6% kernel
+0% 8005/dex2oat: 0% user + 0% kernel
52% TOTAL: 42% user + 6.6% kernel + 3.3% iowait

当第一次启动应用程序时,它可以正常工作。当应用程序在单击遥控器上的主页按钮后启动时应用程序退出,而应用程序是 运行。 如果我们尝试相同的过程 3 次,它会正常工作。 请帮助我找到解决方案。

在清单上尝试此代码

  android:clearTaskOnlaunch="true"

每个 activity 示例:-

  <activity
        android:name="com.xxxxx.xxxxxx.xxxxxx.SplashActivity"
        android:clearTaskOnlaunch="true"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>