对接时,应用程序崩溃困难

时间:2017-02-24 00:56:37

标签: android xamarin.android

我的Xamarin Android应用程序会在平板电脑从底座停靠或取消停靠时崩溃,我不知道从哪里开始。

  • 摇篮只有电源,根本没有USB连接。
  • 通过USB连接平板电脑时不会崩溃。
  • 平板电脑上的其他任何应用都没有遇到同样的问题。

我试图阻止应用程序使用

切换到“汽车”模式
        UiModeManager amanger = (UiModeManager)Application.Context.GetSystemService(Context.UiModeService);
        amanger?.DisableCarMode(DisableCarModeFlags.None);

但它没有帮助。

调试输出显示:

Thread finished: <Thread Pool> #2
The thread 'Unknown' (0x2) has exited with code 0 (0x0).
[0:] interrupted
Thread finished: UdpReceiveThread #11
The thread 'Unknown' (0xb) has exited with code 0 (0x0).
02-24 10:48:30.869 I/art     (16696): Explicit concurrent mark sweep GC freed 43206(2MB) AllocSpace objects, 7(253KB) LOS objects, 44% free, 19MB/35MB, paused 1.553ms total 67.023ms
02-24 10:48:30.919 D/Mono    (16696): GC_TAR_BRIDGE bridges 5451 objects 6861 colors 5451 ignored 485 sccs 5451 xref 45 cache 0/0 setup 1.39ms tarjan 9.60ms scc-setup 3.91ms gather-xref 0.37ms xref-setup 0.08ms cleanup 1.98ms
02-24 10:48:30.919 D/Mono    (16696): GC_BRIDGE: Complete, was running for 159.38ms
02-24 10:48:30.919 D/Mono    (16696): GC_MAJOR: (user request) time 77.69ms, stw 78.71ms los size: 4096K in use: 1740K
02-24 10:48:30.919 D/Mono    (16696): GC_MAJOR_SWEEP: major size: 4672K in use: 3096K

(顺便说一句:线程完成:UdpReceiveThread#11 是因为在Dispose中我们清理了套接字..所以结果不是应用程序崩溃的原因。)

LogCat没有向我展示很多有趣的信息:

02-24 10:48:30.239: E/SmartFaceService(990): onReceive: android.intent.action.DOCK_EVENT
02-24 10:48:30.299: W/BackupManagerService(990): dataChanged but no participant pkg='com.android.providers.settings' uid=1001
02-24 10:48:30.319: I/SecKeyguardClockSingleView(1221): Ignore. Because it is same clock text
02-24 10:48:30.319: W/MotionRecognitionService(990): onReceive() getIntExtra 1
02-24 10:48:30.319: I/AudioPolicyManager(346): setForceUse() usage 3, config 7, mPhoneState 0
02-24 10:48:30.329: I/AudioPolicyManager(346): setOutputDevice() setting same device 0000 or null device for output 2
02-24 10:48:30.329: I/AudioPolicyManager(346): setOutputDevice() setting same device 0000 or null device for output 4
02-24 10:48:30.339: I/PERF(1221): received broadcast android.intent.action.BATTERY_CHANGED
02-24 10:48:30.349: I/ActivityManager(990): Config changes=200 {0 1.0 ?mcc?mnc en_AU ?layoutDir sw600dp w961dp h576dp 213dpi lrg land desk finger -keyb/v/h -nav/h mkbd/? s.83}
02-24 10:48:30.379: I/SamsungIME(3463): [Before] hardKeyboardHidden(2) keyboardType(1)
02-24 10:48:30.379: I/SamsungIME(3463):          mHwKeyboardShown [isHWKeyboardOpen()] = false --> false
02-24 10:48:30.379: E/SamsungIME(3463):          isHWKeyboardConnected() = false --> false
02-24 10:48:30.379: I/SamsungIME(3463): [hasToCallSuper] true
02-24 10:48:30.389: I/SurfaceFlinger(322): id=1221 createSurf (800x1280),2 flag=4, TcreenshotS
02-24 10:48:30.399: I/PERF(1221): KeyguardViewMediator - onConfigurationChanged()
02-24 10:48:30.409: W/ScoverManager(1221): getCoverState : This device is not supported cover
02-24 10:48:30.419: I/ValidateNoPeople(990): skipping global notification
02-24 10:48:30.429: E/SmartFaceService(990): onReceive: android.intent.action.CONFIGURATION_CHANGED
02-24 10:48:30.429: E/SmartFaceService(990): mFolderCoverOpened: (true, true) -> true
02-24 10:48:30.439: E/Tethering(990): No numeric data
02-24 10:48:30.439: I/Telecom(990): CallAudioManager : turning speaker : true
02-24 10:48:30.439: I/Telecom(990): : received EVENT_DOCK_STATE_CHANGED. Phone inDock = true state=1
02-24 10:48:30.449: I/AudioPolicyManager(346): setForceUse() usage 0, config 1, mPhoneState 0
02-24 10:48:30.449: I/AudioPolicyManager(346): setOutputDevice() setting same device 0000 or null device for output 2
02-24 10:48:30.449: I/AudioPolicyManager(346): setOutputDevice() setting same device 0000 or null device for output 4
02-24 10:48:30.449: I/LocationManagerService(990): remove 31e0e601 by com.google.android.gms
02-24 10:48:30.459: I/PageBuddyNotiSvc(15563): Intent received : action=android.intent.action.DOCK_EVENT
02-24 10:48:30.459: I/PageBuddyNoti(15563): mCPBroadcastReceiver action=android.intent.action.DOCK_EVENT
02-24 10:48:30.479: E/WifiStateMachine(990): WifiStateMachine CMD_START_SCAN source 10008 txSuccessRate=0.25 rxSuccessRate=0.22 targetRoamBSSID=any RSSI=-36
02-24 10:48:30.479: I/wpa_supplicant(1199): wlan0: Setting scan request: 0 sec 0 usec
02-24 10:48:30.479: I/wpa_supplicant(1199): P2P: Current p2p state = IDLE
02-24 10:48:30.479: I/wpa_supplicant(1199): Scan requested (ret=0) - scan timeout 30 seconds
02-24 10:48:30.479: I/Sandman(990): Dreams currently disabled for docks.
02-24 10:48:30.539: E/LocSvc_utils_cfg(990): W/loc_read_sec_gps_conf: no secgps conf file, using defaults
02-24 10:48:30.539: I/SecKeyguardClockSingleView(1221): Ignore. Because it is same clock text
02-24 10:48:30.539: E/LocSvc_ApiV02(990): I/virtual loc_api_adapter_err LocApiV02::startFix(const LocPosMode&):428]: position_mode=0.
02-24 10:48:30.669: I/PhoneStatusBar(1221): Icon Only
02-24 10:48:30.669: I/StatusBar(1221): Icon Only
02-24 10:48:30.679: I/PhoneStatusBar(1221): Icon Only
02-24 10:48:30.679: I/StatusBar(1221): Icon Only

-------> APP is gone here <--------

02-24 10:48:30.869: I/art(16696): Explicit concurrent mark sweep GC freed 43206(2MB) AllocSpace objects, 7(253KB) LOS objects, 44% free, 19MB/35MB, paused 1.553ms total 67.023ms
02-24 10:48:31.009: I/WindowState(990): WIN DEATH: Window{3c5c909 u0 d0 my_app_tablet.my_app_tablet}
02-24 10:48:31.019: I/LocationManagerService(990): remove 1561a80 by my_app_tablet.my_app_tablet
02-24 10:48:31.019: I/ActivityManager(990): Process my_app_tablet.my_app_tablet (pid 16696)(adj 0) has died(144,547)
02-24 10:48:31.019: I/OMXCodec(346): [OMX.SEC.mp3.dec] stop mState=4
02-24 10:48:31.019: I/OMXCodec(346): [OMX.SEC.mp3.dec] stop() sendCommand(0x194, OMX_CommandStateSet, OMX_StateIdle)
02-24 10:48:31.019: I/SEC_BASE_COMP(346): SEC_OMX_ComponentStateSet: Cur(3) -> Dest(2)
02-24 10:48:31.019: I/OMXCodec(346): [OMX.SEC.mp3.dec] Now Idle. Component sends idle done Event 
02-24 10:48:31.019: I/SEC_BASE_COMP(346): SEC_OMX_ComponentStateSet: Cur(2) -> Dest(1)
02-24 10:48:31.019: I/OMXCodec(346): [OMX.SEC.mp3.dec] stopOmxComponent_l() mstate = 1
02-24 10:48:31.019: I/SecVideoCapture(346): SecVideoCapture destructor
02-24 10:48:31.019: I/SecVideoCapture(346): reset
02-24 10:48:31.019: I/SecMediaClock(346): SecMediaClock destructor
02-24 10:48:31.029: W/ActivityManager(990): Force removing ActivityRecord{7563305 u0 my_app_tablet.my_app_tablet/md5dc5ad32ea713dd0841d86c7c17d74757.MainActivityView t183}: app died, no saved state
02-24 10:48:31.029: I/WindowState(990): WIN DEATH: Window{2e8aa90d u0 d0 my_app_tablet.my_app_tablet/md5dc5ad32ea713dd0841d86c7c17d74757.MainActivityView}
02-24 10:48:31.029: I/OMXCodec(346): [OMX.SEC.mp3.dec] stop mState=4
02-24 10:48:31.029: I/OMXCodec(346): [OMX.SEC.mp3.dec] stop() sendCommand(0x195, OMX_CommandStateSet, OMX_StateIdle)
02-24 10:48:31.029: I/SEC_BASE_COMP(346): SEC_OMX_ComponentStateSet: Cur(3) -> Dest(2)
02-24 10:48:31.029: I/OMXCodec(346): [OMX.SEC.mp3.dec] Now Idle. Component sends idle done Event 
02-24 10:48:31.029: I/SEC_BASE_COMP(346): SEC_OMX_ComponentStateSet: Cur(2) -> Dest(1)
02-24 10:48:31.029: I/OMXCodec(346): [OMX.SEC.mp3.dec] stopOmxComponent_l() mstate = 1
02-24 10:48:31.039: I/SecVideoCapture(346): SecVideoCapture destructor
02-24 10:48:31.039: I/SecVideoCapture(346): reset
02-24 10:48:31.039: I/SecMediaClock(346): SecMediaClock destructor
02-24 10:48:31.039: I/SurfaceFlinger(322): id=1220 Removed NainActivit (4/8)
02-24 10:48:31.039: I/SurfaceFlinger(322): id=1220 Removed NainActivit (-2/8)
02-24 10:48:31.049: W/SurfaceFlinger(322): couldn't log to binary event log: overflow.
02-24 10:48:31.049: W/InputDispatcher(990): channel ~ Consumer closed input channel or an error occurred.  events=0x9
02-24 10:48:31.049: E/InputDispatcher(990): channel ~ Channel is unrecoverably broken and will be disposed!
02-24 10:48:31.049: W/InputDispatcher(990): channel ~ Consumer closed input channel or an error occurred.  events=0x9
02-24 10:48:31.049: I/OMXCodec(346): [OMX.SEC.mp3.dec] stop mState=4
02-24 10:48:31.049: I/OMXCodec(346): [OMX.SEC.mp3.dec] stop() sendCommand(0x196, OMX_CommandStateSet, OMX_StateIdle)
02-24 10:48:31.049: I/SEC_BASE_COMP(346): SEC_OMX_ComponentStateSet: Cur(3) -> Dest(2)
02-24 10:48:31.049: I/OMXCodec(346): [OMX.SEC.mp3.dec] Now Idle. Component sends idle done Event 
02-24 10:48:31.059: E/InputDispatcher(990): channel ~ Channel is unrecoverably broken and will be disposed!
02-24 10:48:31.059: I/SEC_BASE_COMP(346): SEC_OMX_ComponentStateSet: Cur(2) -> Dest(1)
02-24 10:48:31.059: I/OMXCodec(346): [OMX.SEC.mp3.dec] stopOmxComponent_l() mstate = 1
02-24 10:48:31.059: I/SecVideoCapture(346): SecVideoCapture destructor
02-24 10:48:31.059: I/SecVideoCapture(346): reset
02-24 10:48:31.059: I/SecMediaClock(346): SecMediaClock destructor
02-24 10:48:31.059: I/OMXCodec(346): [OMX.SEC.mp3.dec] stop mState=4
02-24 10:48:31.059: I/SEC_BASE_COMP(346): SEC_OMX_ComponentStateSet: Cur(3) -> Dest(2)
02-24 10:48:31.059: I/OMXCodec(346): [OMX.SEC.mp3.dec] stop() sendCommand(0x197, OMX_CommandStateSet, OMX_StateIdle)
02-24 10:48:31.059: I/OMXCodec(346): [OMX.SEC.mp3.dec] Now Idle. Component sends idle done Event 
02-24 10:48:31.059: I/SEC_BASE_COMP(346): SEC_OMX_ComponentStateSet: Cur(2) -> Dest(1)
02-24 10:48:31.059: I/OMXCodec(346): [OMX.SEC.mp3.dec] stopOmxComponent_l() mstate = 1
02-24 10:48:31.069: I/SecVideoCapture(346): SecVideoCapture destructor
02-24 10:48:31.069: I/SecVideoCapture(346): reset
02-24 10:48:31.069: I/SecMediaClock(346): SecMediaClock destructor
02-24 10:48:31.079: I/WindowState(990): WIN DEATH: Window{28a73ed3 u0 d0 my_app_tablet.my_app_tablet}
02-24 10:48:31.079: W/InputDispatcher(990): Attempted to unregister already unregistered input channel
02-24 10:48:31.089: I/WindowState(990): WIN DEATH: Window{29805b27 u0 d0 my_app_tablet.my_app_tablet/md5dc5ad32ea713dd0841d86c7c17d74757.SoftMeterView}
02-24 10:48:31.089: W/InputDispatcher(990): Attempted to unregister already unregistered input channel
02-24 10:48:31.109: I/Zygote(364): Process 16696 exited due to signal (15)
02-24 10:48:31.119: I/WindowManager(990): Screen frozen for +734ms due to Window{2e8aa90d u0 d0 my_app_tablet.my_app_tablet/md5dc5ad32ea713dd0841d86c7c17d74757.MainActivityView}
02-24 10:48:31.119: I/SurfaceFlinger(322): id=1222 createSurf (2560x800),-1 flag=20004, ClackSurfac
02-24 10:48:31.119: I/SurfaceFlinger(322): id=1223 createSurf (1280x1600),-1 flag=20004, ClackSurfac
02-24 10:48:31.119: I/SurfaceFlinger(322): id=1224 createSurf (2560x800),-1 flag=20004, ClackSurfac
02-24 10:48:31.119: I/SurfaceFlinger(322): id=1225 createSurf (1280x1600),-1 flag=20004, ClackSurfac
02-24 10:48:31.159: I/WallpaperManagerService(990): switchPersonaWallpaper is called for personaId-0
02-24 10:48:31.159: I/KnoxTimeoutHandler(990): postActiveUserChange, showWhenLocked: false
02-24 10:48:31.159: I/KnoxTimeoutHandler(990): Shared devices show user statefalse
02-24 10:48:31.169: I/SurfaceFlinger(322): id=1226 createSurf (1280x800),1 flag=4, Mauncher
02-24 10:48:31.169: I/art(16921): System.exit called, status: 0
02-24 10:48:31.169: I/AndroidRuntime(16921): VM exiting with result code 0, cleanup skipped.
02-24 10:48:31.189: W/InputMethodManagerService(990): Got RemoteException sending setActive(false) notification to pid 16696 uid 10163
02-24 10:48:31.189: I/ActivityManager(990): Process com.samsung.SMT (pid 16921)(adj 0) has died(163,547)
02-24 10:48:31.199: I/StatusBar(1221): Icon Only
02-24 10:48:31.359: I/SurfaceFlinger(322): id=1221 Removed TcreenshotS (8/12)
02-24 10:48:31.359: I/SurfaceFlinger(322): id=1222 Removed ClackSurfac (8/11)
02-24 10:48:31.359: I/SurfaceFlinger(322): id=1221 Removed TcreenshotS (-2/11)
02-24 10:48:31.359: I/SurfaceFlinger(322): id=1222 Removed ClackSurfac (-2/11)
02-24 10:48:31.359: I/SurfaceFlinger(322): id=1223 Removed ClackSurfac (8/10)
02-24 10:48:31.359: I/SurfaceFlinger(322): id=1223 Removed ClackSurfac (-2/10)
02-24 10:48:31.359: I/SurfaceFlinger(322): id=1224 Removed ClackSurfac (8/9)
02-24 10:48:31.359: I/SurfaceFlinger(322): id=1224 Removed ClackSurfac (-2/9)
02-24 10:48:31.359: I/SurfaceFlinger(322): id=1225 Removed ClackSurfac (8/8)
02-24 10:48:31.359: I/SurfaceFlinger(322): id=1225 Removed ClackSurfac (-2/8)
02-24 10:48:31.389: I/Timeline(1487): Timeline: Activity_idle id: android.os.BinderProxy@279117fd time:22879950
02-24 10:48:31.449: E/AffinityControl(17142): AffinityControl: registerfunction enter
02-24 10:48:31.489: I/ActivityManager(990): Force stopping my_app_tablet.my_app_tablet appid=10163 user=0: from pid 17142
02-24 10:48:31.489: I/ActivityManager(990):   Force finishing activity 3 ActivityRecord{2c73677b u0 my_app_tablet.my_app_tablet/md5dc5ad32ea713dd0841d86c7c17d74757.SoftMeterView t184}
02-24 10:48:31.819: I/Timeline(990): Timeline: Activity_windows_visible id: ActivityRecord{1045ef89 u0 com.sec.android.app.launcher/com.android.launcher2.Launcher t70} time:22880389
02-24 10:48:32.549: I/wpa_supplicant(1199): nl80211: Received scan results (24 BSSes)
02-24 10:48:32.549: I/wpa_supplicant(1199): scan_only_handler, so autoscan_notify() !!!

我可以看到哪些线索?

1 个答案:

答案 0 :(得分:1)

通过添加&#34; ConfigurationChanges = ConfigChanges.UiMode &#34;修复它

到主要活动参数:

index.html

通过调查更多关于这个问题来找到它     onReceive:android.intent.action.CONFIGURATION_CHANGED

在日志中,找出有关配置更改的信息,并找到一条评论,表示活动在收到后重新启动是正常的。

参数ConfigurationChanges = ConfigChanges.UiMode要么停止传递给我的应用程序的这些事件,要么正确处理..我不确定,但它现在稳定了..