android - ANR 输入调度超时(等待,因为没有窗口有焦点,但有一个可能最终有焦点的应用程序)

标签 android android-anr-dialog

我的应用程序(Xperia Z1 Compact,Android 5.1)的用户在设置我的应用程序时遇到了崩溃。这是工作流程:

LaunchActivity 是 Launch Intent (noHistory=true, singleTask)。它检查这是否是应用程序的第一次启动。这是第一次启动,所以它会启动 BootActivity (noHistory=true, singleTask)。 BootActivity 显示 3 秒的动画,然后打开 AddGoogleNewsActivity (singleTask)。这是打开 AddGoogleNewsActivity 的代码:

在 onCreate 中:

new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
            endSplash();
        }
    }, 3000);


private void endSplash() {
    YoYo.with(Techniques.FadeOut)
            .duration(1000)
            .interpolate(new AccelerateDecelerateInterpolator())
            .withListener(new com.nineoldandroids.animation.Animator.AnimatorListener() {
                @Override
                public void onAnimationStart(com.nineoldandroids.animation.Animator animation) {

                }

                @Override
                public void onAnimationEnd(com.nineoldandroids.animation.Animator animation) {
                }

                @Override
                public void onAnimationCancel(com.nineoldandroids.animation.Animator animation) {

                }

                @Override
                public void onAnimationRepeat(com.nineoldandroids.animation.Animator animation) {

                }
            })
            .playOn(logo);
    YoYo.with(Techniques.FadeOut)
            .duration(1000)
            .interpolate(new AccelerateDecelerateInterpolator())
            .playOn(title2_txt);
    YoYo.with(Techniques.FadeOut)
            .duration(1000)
            .interpolate(new AccelerateDecelerateInterpolator())
            .playOn(title_txt);
    new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
            if (intent.equals("start")) {
                startActivity(new Intent(BootActivity.this, AddGoogleNewsActivity.class));
            } else if (intent.equals("complete")) {
                Intent goToBoot = new Intent(BootActivity.this, HomeActivity.class);
                goToBoot.putExtra("intent", "setupdone");
                startActivity(goToBoot);
            }
        }
    }, 1000);
}

在 AddGoogleNewsActivity 中,该应用获得了 ANR:
ANR 输入调度超时(等待,因为没有窗口具有焦点,但有一个焦点应用程序可能最终在完成启动时添加一个窗口。)

有人知道我该如何解决这个问题吗?

非常感谢!

最佳答案

从 2017 年 5 月 30 日开始编辑:真正的解决方案是这些设备没有可用的文本到语音服务,我需要完全禁用对它的访问以阻止这些崩溃。

关于android - ANR 输入调度超时(等待,因为没有窗口有焦点,但有一个可能最终有焦点的应用程序),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33857793/

相关文章:

java - 错误 incompatible types : android. app.FragmentManager cannot be converted to android.support.v4.app.FragmentManager

java - 华为设备上的文本对齐问题

android - 服务从电话上的所有 Activity 接收触摸事件?

android - 当我的代码没有出现在堆栈上时,如何解释 ANR traces.txt?

java - android 中错误的 CRC32 散列

android - 在 android 中使用辅助功能服务获取大量 ANR

android ANR BillingClient.queryPurchases

android - 谁负责在 Android 中触发应用程序无响应对话框?

android - 您如何解读 Android ANR 报告

android - API key 放在哪里? list 中的资源、元数据或静态变量?