为什么我收到错误“渠道是无法恢复的破坏,将设置!

问题描述 投票:84回答:16

当我尝试启动我AndEngine活动,我得到这个错误:

ERROR/InputDispatcher(21374): channel '4122e148 my.package.AcGame (server)' ~ Channel is unrecoverably broken and will be disposed!

该应用程序不会崩溃,但有一个黑色的屏幕和设备不按“返回”或“家”按钮反应。

有谁知道问题是什么?

android andengine
16个回答
36
投票

其中最常见的原因,我看到的错误是,当我试图在一个活动,是不是在前台显示一个警告对话框或进度对话框。当显示一个对话框后台线程处于暂停活动运行等。


1
投票

在我的情况发生在某些情况下,当我试图显示进度的一个活动,是不是在前台对话框喜欢这两个问题。所以,我驳回进步活动的生命周期的onPause对话框。而问题解决。

无法在公正的观点开始这个动画!显示效果BUG

答:Cannot start this animator on a detached view! reveal effect

为什么我收到错误“渠道是无法恢复的破坏,将设置!

答:Why I am Getting Error 'Channel is unrecoverably broken and will be disposed!'

@Override
protected void onPause() {
    super.onPause();
    dismissProgressDialog();

}

private void dismissProgressDialog() {
    if(progressDialog != null && progressDialog.isShowing())
        progressDialog.dismiss();
}

1
投票

正如我在你的代码面对这个错误,你的某个地方或funcs中库,用在不同的线程运行,因此尝试调用同一线程上的所有代码,它解决了我的问题。

如果从比你的应用程序的UI线程以外的任何线程中调用上的WebView方法,它可能会导致意想不到的结果。例如,如果您的应用程序使用多个线程,你可以使用runOnUiThread()方法,以确保您的代码执行的UI线程上:

Google reference link


0
投票

我有同样的问题。为了解决这个错误:关闭它在模拟器上,然后使用Android Studio中运行它。

当您尝试重新运行应用程序时,应用程序已经在模拟器上运行发生错误。

基本上错误说 - “我没有现有的渠道不再和处理已经建立的连接”为你再次运行从Android Studio中的应用程序。


0
投票

通过所有捐款阅读,它看起来像许多不同的起源具有导致同样的问题的症状。

在我的情况,例如 - 我为我添加很快就这个问题

android:progressBackgroundTintMode="src_over"

我的进度条属性。我认为ADT的GUI设计器是几个错误闻名。因此,我认为这是其中之一。所以,如果你遇到类似的问题症状(只是没有任何意义)与GUI安装播放后,只是尝试回滚你做了什么,并撤消上次GUI修改。

只要按下Ctrl + Z,使用屏幕上的最近修改的文件。

要么:

版本控制工具可能会有所帮助。打开版本控制面板 - 选择本地更改标签,查看最近修改的(也许.XML)文件。

右键点击一些最可疑的一个,然后单击显示DIFF。然后,只需猜出哪个修饰线可以负责。

祝好运 :)


0
投票

我有这个问题,原因竟是一个NullPointerException。但它并没有呈现在我面前为一体!

我的输出:屏幕上被卡住了很长的时间和ANR

我的状态:布局xml文件被列入另一个布局,但所引用的观点包括没有附加的布局给予ID。 (我有同样的子视图的两个类似的实现,因此资源ID与给定的名称创建)

注:这是一个自定义对话框布局,因此检查对话框首先可以有点帮助

结论:有一些内存泄漏发生在搜索子视图的ID。


0
投票

在内存泄漏的情况下发生这种错误。例如,如果你使用的是Android组件(活动/服务/等)的任何静态背景及其得到由系统杀死。

例如:在通知区域中的音乐播放器控件。使用前台服务,并通过类似的PendingIntent下面设置通知信道的动作。

Intent notificationIntent = new Intent(this, MainActivity.class);
        notificationIntent.setAction(AppConstants.ACTION.MAIN_ACTION);
        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,
                notificationIntent, 0);

        Intent previousIntent = new Intent(this, ForegroundService.class);
        previousIntent.setAction(AppConstants.ACTION.PREV_ACTION);
        PendingIntent ppreviousIntent = PendingIntent.getService(this, 0,
                previousIntent, 0);

        Intent playIntent = new Intent(this, ForegroundService.class);
        playIntent.setAction(AppConstants.ACTION.PLAY_ACTION);
        PendingIntent pplayIntent = PendingIntent.getService(this, 0,
                playIntent, 0);

        Intent nextIntent = new Intent(this, ForegroundService.class);
        nextIntent.setAction(AppConstants.ACTION.NEXT_ACTION);

        Bitmap icon = BitmapFactory.decodeResource(getResources(),
                R.drawable.ic_launcher);

        NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        String NOTIFICATION_CHANNEL_ID = "my_channel_id_01";

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            NotificationChannel notificationChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "My Notifications", NotificationManager.IMPORTANCE_HIGH);

            // Configure the notification channel.
            notificationChannel.setDescription("Channel description");
            notificationChannel.enableLights(true);
            notificationChannel.setLightColor(Color.RED);
            notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
            notificationChannel.setVibrationPattern(new long[]{0, 1000, 500, 1000});
            notificationChannel.enableVibration(true);
            notificationManager.createNotificationChannel(notificationChannel);
        }

        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID);
        Notification notification = notificationBuilder
                .setOngoing(true)
                .setAutoCancel(true)
                .setWhen(System.currentTimeMillis())
                .setContentTitle("Foreground Service")
                .setContentText("Foreground Service Running")
                .setSmallIcon(R.drawable.ic_launcher)
                .setLargeIcon(Bitmap.createScaledBitmap(icon, 128, 128, false))
                .setContentIntent(pendingIntent)
                .setPriority(NotificationManager.IMPORTANCE_MAX)
                .setCategory(Notification.CATEGORY_SERVICE)
                .setTicker("Hearty365")
                .build();
        startForeground(AppConstants.NOTIFICATION_ID.FOREGROUND_SERVICE,
                notification);

如果该通知的信道得到突然断裂(可能是通过系统,就像小蜜设备时,我们清理出后台应用程序),那么由于内存泄漏此错误是由系统抛出。


-1
投票

其中一个我看到的错误我的后端(node.js的)原因包太旧了。当我更新了我的所有包解决我的问题。

npm update **or** npm mongoose@latest --save

13
投票

我认为你有内存泄漏的地方。你可以找到提示,以避免内存泄漏here。您还可以了解的工具来跟踪它here


7
投票

你可以看到这个输出here的源代码:

void InputDispatcher::onDispatchCycleBrokenLocked(
        nsecs_t currentTime, const sp<Connection>& connection) {
    ALOGE("channel '%s' ~ Channel is unrecoverably broken and will be disposed!",
            connection->getInputChannelName());
    CommandEntry* commandEntry = postCommandLocked(
            & InputDispatcher::doNotifyInputChannelBrokenLockedInterruptible);
    commandEntry->connection = connection;
}

它的事业由周期破锁...


7
投票

你有没有使用其他UI线程?你不应该使用超过1个UI线程,并使它看起来像一个三明治。这样做将导致内存泄漏。

我已经解决了类似的问题,3天前...

为了使事情短:主线程可以有很多UI线程做的多部作品,但如果包含UI线程一个子线程里面,UI线程可能没有,而它的父线程已经完成了完成其工作但其工作中,这会导致内存泄漏。

例如对于...片段UI应用程序......这将导致内存泄漏。

getActivity().runOnUiThread(new Runnable(){

   public void run() {//No.1

  ShowDataScreen();

getActivity().runOnUiThread(new Runnable(){

    public void run() {//No.2

Toast.makeText(getActivity(), "This is error way",Toast.LENGTH_SHORT).show();

    }});// end of No.2 UI new thread

}});// end of No.1 UI new thread

我的解决方案如下重新排列:

getActivity().runOnUiThread(new Runnable(){

   public void run() {//No.1

ShowDataScreen();

}});// end of No.1 UI new thread        

getActivity().runOnUiThread(new Runnable(){

   public void run() {//No.2

Toast.makeText(getActivity(), "This is correct way",Toast.LENGTH_SHORT).show();

}});// end of No.2 UI new thread

你参考。

我是台湾人,我很高兴再次在这里回答。


4
投票

我得到了类似的错误(我的应用程序崩溃)后,我改名strings.xml东西,忘了修改其他文件(偏好XML资源文件和Java代码)。

IDE(机器人工作室)没有表现出任何错误。但是,当我修我的XML文件和Java代码,应用程序运行正常。所以,也许有你的XML文件或常量一些小失误。


1
投票

我有同样的问题,但我的是由于Android的数据库内存泄漏。我跳过一个光标。因此,设备死机,以便修复内存泄漏。如果您正在使用Android的数据库检查工作,如果你跳过一个光标,而从数据库中检索


1
投票

它发生,我,以及在使用和发动机运行游戏。它被固定后,我加入了下面的代码,我manifest.xml中。此代码应添加到您的mainactivity。

android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|mcc|mnc"

1
投票

我有同样的问题。我的是由于第三个罐子,但logcat的没赶上例外,我解决了更新的第三个罐子,希望这些将帮助。


1
投票

我有同样的问题了。在我的情况是导致试图重现影片与不良编纂时(需要太多的内存)。 This帮我捕获错误,并要求同一视频的另一个版本。 https://stackoverflow.com/a/11986400/2508527

© www.soinside.com 2019 - 2024. All rights reserved.