java.lang.IllegalArgumentException:视图未附加到窗口管理器 - 未列出任何活动

时间:2013-03-22 22:41:06

标签: android

我正在使用Crittercism来跟踪我的应用中的崩溃。我遇到了一个我不知道如何处理。

那是Crittersim日志:

崩溃线程

0   
java.lang.IllegalArgumentException: View not attached to window manager
1   
at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:656)
2   
at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:349)
3   
at android.view.WindowManagerImpl$CompatModeWrapper.removeView(WindowManagerImpl.java:160)
4   
at android.widget.ZoomButtonsController.setVisible(ZoomButtonsController.java:407)
5   
at android.widget.ZoomButtonsController$2.handleMessage(ZoomButtonsController.java:179)
6   
at android.os.Handler.dispatchMessage(Handler.java:99)
7   
at android.os.Looper.loop(Looper.java:137)
8   
at android.app.ActivityThread.main(ActivityThread.java:5059)
9   
at java.lang.reflect.Method.invokeNative(Native Method)
10  
at java.lang.reflect.Method.invoke(Method.java:511)
11  
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
12  
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
13  
at dalvik.system.NativeStart.main(Native Method)
27 other threads

线程:AsyncTask#4(id = 721,state = WAITING)

0   
java.lang.Object.wait(Native Method)
1   
java.lang.Thread.parkFor(Thread.java:1231)
2   
sun.misc.Unsafe.park(Unsafe.java:323)
3   
java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
4   
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2022)
5   
java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:413)
6   
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009)
7   
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069)
8   
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
9   
java.lang.Thread.run(Thread.java:856)

线程:ImageContentLoader_Cache(id = 709,state = RUNNABLE)

0   
android.os.MessageQueue.nativePollOnce(Native Method)
1   
android.os.MessageQueue.next(MessageQueue.java:125)
2   
android.os.Looper.loop(Looper.java:124)
3   
android.os.HandlerThread.run(HandlerThread.java:60)

主题:pool-4-thread-1(id = 695,state = WAITING)

0   
java.lang.Object.wait(Native Method)
1   
java.lang.Thread.parkFor(Thread.java:1231)
2   
sun.misc.Unsafe.park(Unsafe.java:323)
3   
java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
4   
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2022)
5   
java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:413)
6   
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009)
7   
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069)
8   
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
9   
java.lang.Thread.run(Thread.java:856)

线程:请求工作线程(id = 707,state = RUNNABLE)

0   
android.os.MessageQueue.nativePollOnce(Native Method)
1   
android.os.MessageQueue.next(MessageQueue.java:125)
2   
android.os.Looper.loop(Looper.java:124)
3   
com.[XXXXXXX].android.services.ServerTalk.run(ServerTalk.java:2043)
4   
java.lang.Thread.run(Thread.java:856)

我的应用只有一个引用:

融为一体[XXXXXXX] .android.services.ServerTalk.run(ServerTalk.java:2043)

导致这一行:

@Override
public void run()
{
    Looper.prepare();
    synchronized (this)
    {
        if (mCanRunLooper)
        {
            mLooper = Looper.myLooper();
            mRequestHandler = new RequestThreadHandler();
        }
        else
        {
            return;
        }
    }
    mEvent.open();
    Looper.loop();  <----- [HERE]

}

此ServerTalk是一种处理Web请求的服务,并且正在被各种活动调用。问题是这里没有列出任何活动,实际上我的应用程序甚至没有列在实际崩溃的线程中。这次崩溃多次发生,但我自己无法复制。我不知道这是什么。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

“未附加到窗口管理器的视图”表示它不是层次结构中的活动视图。在堆栈中稍微进一步看到“ZoomButtonsController.setVisible”。

你说ServerTalk是一项服务。为什么要尝试在视图上调用方法?服务不能有UI。