code

오류가 발생하는 이유 '채널이 복구 할 수 없게 손상되어 폐기됩니다!'

codestyles 2020. 9. 6. 10:03
반응형

오류가 발생하는 이유 '채널이 복구 할 수 없게 손상되어 폐기됩니다!'


AndEngine Activity 를 시작하려고 하면 다음 오류가 발생합니다.

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

앱이 다운되지는 않지만 검은 색 화면이 표시되고 기기가 '뒤로'또는 '홈'버튼을 눌러도 반응하지 않습니다.

문제가 무엇인지 아는 사람이 있습니까?


오류가 발생하는 가장 일반적인 이유 중 하나는 포 그라운드에 있지 않은 활동에서 경고 대화 상자 또는 진행률 대화 상자를 표시하려고 할 때입니다. 대화 상자를 표시하는 백그라운드 스레드가 일시 중지 된 활동에서 실행 중일 때와 같습니다.


어딘가에 메모리 누수가 있다고 생각합니다. 여기에서 메모리 누수를 방지하는 팁을 찾을 수 있습니다 . 또한 여기에서 이를 추적하는 도구에 대해 알아볼 수 있습니다 .


이 출력에 대한 소스 코드는 여기에서 볼 수 있습니다 .

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;
}

그것은 잠긴 사이클로 인한 원인입니다 ...


다른 UI 스레드를 사용 했습니까? 두 개 이상의 UI 스레드를 사용하지 말고 샌드위치처럼 보이게해야합니다. 이렇게하면 메모리 누수가 발생합니다.

2 일 전에 비슷한 문제를 해결했습니다 ...

짧게 유지하기 위해 : 메인 스레드는 여러 작업을 수행하기 위해 많은 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

참고로.

저는 대만인입니다. 여기에서 다시 한 번 대답하게되어 기쁩니다.


I got similar error (my app crashes) after I renamed something in strings.xml and forgot to modify other files (a preference xml resource file and java code).

IDE (android studio) didn't showed any errors. But, after I repaired my xml files and java code, app ran okay. So, maybe there are some small mistakes in your xml files or constants.


I had the same problem but mine was Due To an Android database memory leak. I skipped a cursor. So the device crashes so as to fix that memory leak. If you are working with the Android database check if you skipped a cursor while retrieving from the database


It happened for me as well while running a game using and-engine. It was fixed after i added the below code to my manifest.xml. This code should be added to your mainactivity.

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

I had the same problem. Mine was due to a third jar, but the logcat did not catch the exception, i solved by update the third jar, hope these will help.


I was having the same problem too. In my case was caused when trying to reproduce videos with a poor codification (demanded too much memory). This helped me to catch the error and request another version of the same video. https://stackoverflow.com/a/11986400/2508527


In my case these two issue occurs in some cases like when I am trying to display the progress dialog in an activity that is not in the foreground. So, I dismiss the progress dialog in onPause of the activity lifecycle. And the issue is resolved.

Cannot start this animator on a detached view! reveal effect BUG

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

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

ANSWER: 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();
}

As I faced this error, somewhere in your code your funcs or libraries that used run on different threads, so try to call all code on the same thread , it fixed my problem.

If you call methods on WebView from any thread other than your app's UI thread, it can cause unexpected results. For example, if your app uses multiple threads, you can use the runOnUiThread() method to ensure your code executes on the UI thread:

Google reference link


I had the same problem. To solve the error: Close it on the emulator and then run it using Android Studio.

The error happens when you try to re-run the app when the app is already running on the emulator.

Basically the error says - "I don't have the existing channel anymore and disposing the already established connection" as you have run the app from Android Studio again.


Reading through all contributions, it looks like many different origins exhibit cause this same problem symptoms.

In my case for instance - I got this problem as soon as I added

android:progressBackgroundTintMode="src_over"

to my progress bar properties. I think the GUI designer of ADT is known for several bugs. Hence I assume this is one of them. So if you encounter similar problem symptoms (that just do not make sense) after playing with your GUI setup, just try to roll back what you did and undo your last GUI modifications.

Just press Ctrl+z with the recently modified file on screen.

Or:

The Version Control tool could be helpful. Open the Version Control panel - choose Local Changes tab and see recently modified (perhaps .xml) files.

Right click some most suspicious one and click Show Diff. Then just guess which modified line could be responsible.

Good luck :)


I had this issue and the cause was actually a NullPointerException. But it was not presented to me as one!

my Output: screen was stuck for a very long period and ANR

My State : the layout xml file was included another layout, but referenced the included view without giving id in the attached layout. (i had two more similar implementations of the same child view, so the resource id was created with the given name)

Note : it was a Custom Dialog layout, so checking dialogs first may help a bit

Conclusion : There is some memory leak happened on searching the id of the child view.


This error occurred in case of memory leak. For example if you have any static context of an Android component (Activity/service/etc) and its gets killed by system.

Example: Music player controls in notification area. Use a foreground service and set actions in the notification channel via PendingIntent like below.

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);

And if this notification channel get broken abruptly (may be by system, like in Xiomi devices when we clean out the background apps), then due to memory leaks this error is thrown by system.


One of the reasons I see that error my backend(node.js) packages too old. When I updated all my packages solved my problem.

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

참고URL : https://stackoverflow.com/questions/12459719/why-i-am-getting-error-channel-is-unrecoverably-broken-and-will-be-disposed

반응형