Looper Could not create wake pip

日志打印

A/Looper(31455): Could not create wake pipe. errno=24
..
A/Looper(1960): Could not create wake pipe. errno=24
A/libc(1960): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)
..
A/Looper(16848): Could not create wake pipe. errno=24

App直接飞掉

 

问题:

Native Looper 初始化失败

 

根据日志和APP操作查找Looper.preare();出现的地方

 

    public static void showToast(final String toast, final int showTimeFlag, final Context context)
    {
        new Thread(new Runnable()
        {
            @Override
            public void run()
            {
                Looper.prepare();
                Toast.makeText(context, toast, showTimeFlag).show();
                Looper.loop();
            }
        }).start();
    }

 

修改:

    public static void showToast(final String toast, final int showTimeFlag, final Context context)
    {
        new Thread()
        {
            public void run()
            {
                System.out.println("Start Looper...");
                // Prepare looper
                Looper.prepare();

                // Register Queue listener hook
                MessageQueue queue = Looper.myQueue();
                queue.addIdleHandler(new IdleHandler()
                {
                    int    mReqCount    = 0;

                    @Override
                    public boolean queueIdle()
                    {
                        if (++mReqCount == 2)
                        {
                            // Quit looper
                            System.out.println("Looper.myLooper().quit()");
                            Looper.myLooper().quit();
                            return false;
                        } else
                            return true;
                    }
                });

                // Show Toast- will be called when Looper.loop() starts
                Toast.makeText(context, toast, showTimeFlag).show();
                // Start looping Message Queue- Blocking call
                Looper.loop();
                System.out.println("It appears after Looper.myLooper().quit()");
            }
        }.start();
    }

 

 

and then got this log:

W/MessageQueue(26006): Handler (android.os.Handler) {42771e28} sending message to a Handler on a dead thread
W/MessageQueue(26006): java.lang.RuntimeException: Handler (android.os.Handler) {42771e28} sending message to a Handler on a dead thread
W/MessageQueue(26006):     at android.os.MessageQueue.enqueueMessage(MessageQueue.java:196)
W/MessageQueue(26006):     at android.os.Handler.sendMessageAtTime(Handler.java:473)
W/MessageQueue(26006):     at android.os.Handler.sendMessageDelayed(Handler.java:446)
W/MessageQueue(26006):     at android.os.Handler.post(Handler.java:263)
W/MessageQueue(26006):     at android.widget.Toast$TN.hide(Toast.java:358)
W/MessageQueue(26006):     at android.app.ITransientNotification$Stub.onTransact(ITransientNotification.java:55)
W/MessageQueue(26006):     at android.os.Binder.execTransact(Binder.java:338)
W/MessageQueue(26006):     at dalvik.system.NativeStart.run(Native Method)


W/MessageQueue(26006): Handler (android.os.Handler) {42853888} sending message to a Handler on a dead thread
W/MessageQueue(26006): java.lang.RuntimeException: Handler (android.os.Handler) {42853888} sending message to a Handler on a dead thread
W/MessageQueue(26006):     at android.os.MessageQueue.enqueueMessage(MessageQueue.java:196)
W/MessageQueue(26006):     at android.os.Handler.sendMessageAtTime(Handler.java:473)
W/MessageQueue(26006):     at android.os.Handler.sendMessageDelayed(Handler.java:446)
W/MessageQueue(26006):     at android.os.Handler.post(Handler.java:263)
W/MessageQueue(26006):     at android.widget.Toast$TN.hide(Toast.java:358)
W/MessageQueue(26006):     at android.app.ITransientNotification$Stub.onTransact(ITransientNotification.java:55)
W/MessageQueue(26006):     at android.os.Binder.execTransact(Binder.java:338)
W/MessageQueue(26006):     at dalvik.system.NativeStart.run(Native Method)
I/System.out(26006): Looper.myLooper().quit()
I/System.out(26006): It appears after Looper.myLooper().quit()
E/InputChannel-JNI(26006): Error 24 dup receive pipe fd 775.
E/InputChannel-JNI(26006): Error 24 dup send pipe fd 1022.
W/MessageQueue(26006): Handler (android.os.Handler) {426c8ba0} sending message to a Handler on a dead thread
W/MessageQueue(26006): java.lang.RuntimeException: Handler (android.os.Handler) {426c8ba0} sending message to a Handler on a dead thread
W/MessageQueue(26006):     at android.os.MessageQueue.enqueueMessage(MessageQueue.java:196)
W/MessageQueue(26006):     at android.os.Handler.sendMessageAtTime(Handler.java:473)
W/MessageQueue(26006):     at android.os.Handler.sendMessageDelayed(Handler.java:446)
W/MessageQueue(26006):     at android.os.Handler.post(Handler.java:263)
W/MessageQueue(26006):     at android.widget.Toast$TN.hide(Toast.java:358)
W/MessageQueue(26006):     at android.app.ITransientNotification$Stub.onTransact(ITransientNotification.java:55)
W/MessageQueue(26006):     at android.os.Binder.execTransact(Binder.java:338)
W/MessageQueue(26006):     at dalvik.system.NativeStart.run(Native Method)
E/InputChannel-JNI(26006): Error 24 dup receive pipe fd 775.
E/InputChannel-JNI(26006): Error 24 dup send pipe fd 1022.
E/InputChannel-JNI(26006): Error 24 dup receive pipe fd 775.
E/InputChannel-JNI(26006): Error 24 dup send pipe fd 1022.
E/InputChannel-JNI(26006): Error 24 dup receive pipe fd 775.
E/InputChannel-JNI(26006): Error 24 dup send pipe fd 1022.
W/dalvikvm(26006): threadid=149: thread exiting with uncaught exception (group=0x40aa4390)
E/AndroidRuntime(26006): FATAL EXCEPTION: Thread-3671
E/AndroidRuntime(26006): java.lang.RuntimeException: Could not read input channel file descriptors from parcel.
E/AndroidRuntime(26006):     at android.view.InputChannel.nativeReadFromParcel(Native Method)
E/AndroidRuntime(26006):     at android.view.InputChannel.readFromParcel(InputChannel.java:135)
E/AndroidRuntime(26006):     at android.view.IWindowSession$Stub$Proxy.add(IWindowSession.java:541)
E/AndroidRuntime(26006):     at android.view.ViewRootImpl.setView(ViewRootImpl.java:488)
E/AndroidRuntime(26006):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:305)
E/AndroidRuntime(26006):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:215)
E/AndroidRuntime(26006):     at android.widget.Toast$TN.handleShow(Toast.java:386)
E/AndroidRuntime(26006):     at android.widget.Toast$TN$1.run(Toast.java:304)
E/AndroidRuntime(26006):     at android.os.Handler.handleCallback(Handler.java:605)
E/AndroidRuntime(26006):     at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime(26006):     at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(26006):     at com.dhzwan.shapp.utility.Utils$3.run(Utils.java:531)
W/dalvikvm(26006): threadid=150: thread exiting with uncaught exception (group=0x40aa4390)

 

posted on 2014-10-29 09:51  奋进的苦瓜  阅读(1662)  评论(0编辑  收藏  举报