Android 无法查找窗口 - 2 个星系关系上同一应用程序的不同行为

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10219146/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 02:54:47  来源:igfitidea点击:

Failed looking up window - different behaviors from same app on 2 galaxy nexus

androidandroid-activityandroid-4.0-ice-cream-sandwich

提问by ejo4041

I have two Galaxy Nexus phones. The phones are the same firmware version 4.0.2, same build number, same kernel version. When I deploy the same exact app to both of the phones using Eclipse, I see different behaviors from each.

我有两部 Galaxy Nexus 手机。这两款手机的固件版本相同,固件版本为 4.0.2,内部版本号相同,内核版本相同。当我使用 Eclipse 将完全相同的应用程序部署到两部手机时,我看到每个手机都有不同的行为。

On one phone, everything works as expected. On the other phone, the main Activity crashes when switching to another activity and back to the main one, both by back button and by other activities finishing and returning to the activity that created it. The only clue I have to this problem is this error:

在一部手机上,一切都按预期进行。在另一部手机上,通过后退按钮和其他活动完成并返回到创建它的活动,主活动在切换到另一个活动并返回主活动时崩溃。我对这个问题的唯一线索是这个错误:

04-18 17:43:30.811: I/ActivityManager(207): Displayed org.mitre.Mobile/.Activities.QueryActivity: +430ms
04-18 17:43:30.819: I/n*.w*.w*.ZoomButtonsCo*(4962): invoke: onVisibilityChanged listener: org.osmdroid.views.MapView$MapViewZoomListener@4181ecd8
04-18 17:43:30.843: E/InputQueue-JNI(4962): channel '41d66628 Panel:org.mitre.Mobile/org.mitre.Mobile.Activities.MobileActivity (client)' ~ Publisher closed input channel or an error occurred.  events=0x8
04-18 17:43:30.843: W/WindowManager(207): Force-removing child win Window{41d66628 Panel:org.mitre.Mobile/org.mitre.Mobile.Activities.MobileActivity paused=false} from container Window{420815c8 org.mitre.Mobile/org.mitre.Mobile.Activities.MobileActivity paused=false}
04-18 17:43:30.850: W/WindowManager(207): Failed looking up window
04-18 17:43:30.850: W/WindowManager(207): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@41f9e658 does not exist
04-18 17:43:30.850: W/WindowManager(207):   at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7029)
04-18 17:43:30.850: W/WindowManager(207):   at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7020)
04-18 17:43:30.850: W/WindowManager(207):   at com.android.server.wm.WindowManagerService.removeWindow(WindowManagerService.java:2180)
04-18 17:43:30.850: W/WindowManager(207):   at com.android.server.wm.Session.remove(Session.java:149)
04-18 17:43:30.850: W/WindowManager(207):   at android.view.IWindowSession$Stub.onTransact(IWindowSession.java:124)
04-18 17:43:30.850: W/WindowManager(207):   at com.android.server.wm.Session.onTransact(Session.java:111)
04-18 17:43:30.850: W/WindowManager(207):   at android.os.Binder.execTransact(Binder.java:338)
04-18 17:43:30.850: W/WindowManager(207):   at dalvik.system.NativeStart.run(Native Method)

I haven't really found anything useful on the internet related to this error message. I have some experience with android, but this one has really stumped me. I initially thought this was a nova launcher problem (the phone with the problem has it), but I installed nova on the other phone and still saw the same behaviors.

我还没有在互联网上找到任何与此错误消息相关的有用信息。我有一些使用 android 的经验,但这个真的让我很难过。我最初认为这是一个 nova 启动器问题(有问题的手机有问题),但我在另一部手机上安装了 nova 并且仍然看到相同的行为。

The phone with the app that doesn't work properly is my personal phone, the other is a work phone.

应用无法正常工作的手机是我的个人手机,另一个是工作手机。

采纳答案by ejo4041

Just found out why every activity dies. In Settings > Developer Options, there is a check box called "Don't keep activities" "Destroy every activity as soon as the user leaves it". The box was checked. I just unchecked it. That explains everything.

刚刚发现为什么每个活动都死了。在“设置”>“开发人员选项”中,有一个名为“不要保留活动”“用户离开后立即销毁所有活动”的复选框。该框已被选中。我刚刚取消选中它。这说明了一切。

回答by checkmate711

The issue happened to me after switching build variants. Something may be messed up with your build. Try restarting Android Studio, clean and rebuild. That solved the issue for me.

切换构建变体后,这个问题发生在我身上。您的构建可能会出现问题。尝试重新启动 Android Studio,清理并重建。那为我解决了这个问题。

Good luck!

祝你好运!