Android Studio 调试器意外停止

标签 android android-studio debugging

我无法调试我的应用程序,因为在设置断点并且调试器在它处停止后,它会在两三秒后突然停止,并且应用程序在没有明显原因的情况下退出。

我尝试在不同的位置设置断点,以确保没有其他后台进程干扰它,例如在启动 Activity 中 onCreate 的一开始,但同样的情况发生了,调试器按预期停止,几秒钟后应用程序退出和调试 session 意外结束。

我尝试将 Android Studio 和 Gradle 更新到最新版本(我的 AS 是 3.6.1)和 Gradle 5.6.4(插件版本是 3.6.1)无济于事。还尝试卸载/重新安装该应用程序也无济于事,最后我尝试了 Android Studio 中的“使缓存无效并重新启动”选项,但它都没有奏效。

我无法调试,也不知道还能尝试/做什么。

我的手机是华为 Mate 20 Lite,我也试过重启手机,但没有成功。

一旦调试器停止并且应用程序退出,这是我的“Logcat”(应用程序数字为 com.mycompany.myapp):

2020-03-06 19:20:39.719 1408-1432/? E/WindowManager: icon is null!!
2020-03-06 19:20:39.722 1408-1432/? E/WindowManager: icon is null!!
2020-03-06 19:20:39.724 1408-1432/? E/WindowManager: icon is null!!
2020-03-06 19:20:39.777 2462-5966/? E/HwNaturalBase: [Binder:2462_10]: clearDataByOwner ignore: Found null values with the given ownerPkgName is[com.mycompany.myapp].
2020-03-06 19:20:39.778 2334-4531/? E/AwareLog: GameSdkConfigReader: GameSdkLog: idNameMap: null
2020-03-06 19:20:39.809 847-861/? E/AwareLog: iawared: GetFileContent open /proc/14267/task/14277/cpuset fail errno(2)!
2020-03-06 19:20:39.815 14269-14269/? E/ssioncontrolle: Not starting debugger since process cannot load the jdwp agent.
2020-03-06 19:20:39.817 838-838/? E/Thermal-daemon: [shell_frame] temp_new :29  temp_old :28
2020-03-06 19:20:39.817 1408-1927/? E/ProcessInfoCollector: getProcessInfo: failed to find this proc 
2020-03-06 19:20:39.818 838-838/? E/Thermal-daemon: Report temperature: [shell_frame] temp :29  report_threshold:1
2020-03-06 19:20:39.820 838-838/? E/Thermal-daemon: [ap] temp_new :36  temp_old :35
2020-03-06 19:20:39.821 838-838/? E/Thermal-daemon: Report temperature: [ap] temp :36  report_threshold:1
2020-03-06 19:20:39.855 3259-3259/? E/NfcNci: NfcUtils error: APP do not have nfc permission
2020-03-06 19:20:39.857 3259-3259/? E/NfcNci: NfcUtils error: APP do not have nfc permission
2020-03-06 19:20:39.865 2033-2033/? E/HwLauncher: PowerSaveLauncherModel onPackageChanged: not inPowerSaveLauncher 
2020-03-06 19:20:39.865 2033-2033/? E/HwLauncher: StreetModeLauncherModel onPackageChanged: not inStreetModeLauncher 
2020-03-06 19:20:39.889 653-1175/? E/BufferQueueProducer: [com.huawei.android.launcher/com.huawei.android.launcher.unihome.UniHomeLauncher#1]:1338: disconnect: not connected (req=1)
2020-03-06 19:20:39.890 653-2692/? E/BufferQueueProducer: [com.huawei.android.launcher/com.huawei.android.launcher.unihome.UniHomeLauncher#0]:1338: disconnect: not connected (req=1)
2020-03-06 19:20:39.908 642-642/? E/WifiHAL: enter wifi_get_link_stats
2020-03-06 19:20:39.912 1408-1610/? E/WificondControl: Noise: 0, Snr: 0, Chload: -1
2020-03-06 19:20:39.942 577-14300/? E/ResolverController: No valid NAT64 prefix (123, <unspecified>/0)
2020-03-06 19:20:42.444 1408-8027/? E/WifiService: enforceCanAccessScanResults: hiding ssid and bssidLocation mode is disabled for the device
2020-03-06 19:20:42.456 1408-1602/? E/WifiService: enforceCanAccessScanResults: hiding ssid and bssidLocation mode is disabled for the device
2020-03-06 19:20:42.468 2033-2033/? E/HwLauncher: HwAppMarketDownloadModel handleInstallAction op: 2
2020-03-06 19:20:42.663 7452-7525/? E/HSM_UI: SecurityBroadcastReceiver:SecurityBroadcastReceiver the rainbow is not enabled!
2020-03-06 19:20:42.789 577-14311/? E/ResolverController: No valid NAT64 prefix (123, <unspecified>/0)
2020-03-06 19:20:42.956 642-642/? E/WifiHAL: enter wifi_get_link_stats
2020-03-06 19:20:42.963 1408-1610/? E/WificondControl: Noise: 0, Snr: 0, Chload: -1
2020-03-06 19:20:43.173 653-2692/? E/BufferQueueProducer: [Waiting For Debugger: com.mycompany.myapp#0]:1338: disconnect: not connected (req=1)
2020-03-06 19:20:43.185 1408-7773/? E/InputDispatcher: Window handle Window{d9a7484 u0 Waiting For Debugger: com.mycompany.myapp} has no registered input channel
2020-03-06 19:20:43.201 1408-2090/? E/InputDispatcher: Window handle Window{d9a7484 u0 Waiting For Debugger: com.mycompany.myapp} has no registered input channel
2020-03-06 19:20:43.611 14186-14323/com.mycompany.myapp E/AwareLog: AtomicFileUtils: readFileLines file not exist: android.util.AtomicFile@563b55d
2020-03-06 19:20:43.616 14186-14323/com.mycompany.myapp E/AwareLog: AtomicFileUtils: readFileLines file not exist: android.util.AtomicFile@fa4bed2
2020-03-06 19:20:43.650 577-14328/? E/ResolverController: No valid NAT64 prefix (123, <unspecified>/0)
2020-03-06 19:20:44.824 838-838/? E/Thermal-daemon: [ap] temp_new :37  temp_old :36
2020-03-06 19:20:44.828 838-838/? E/Thermal-daemon: Report temperature: [ap] temp :37  report_threshold:1
2020-03-06 19:20:45.312 1408-1610/? E/WificondControl: Noise: 0, Snr: 0, Chload: -1
2020-03-06 19:20:45.842 8205-10507/? E/HSC_SEC: VirusPkgParser:parse InputStream is null
2020-03-06 19:20:45.985 642-642/? E/WifiHAL: enter wifi_get_link_stats
2020-03-06 19:20:45.987 1408-1610/? E/WificondControl: Noise: 0, Snr: 0, Chload: -1
2020-03-06 19:20:46.733 879-996/? E/ScreemCommon: <LOGMGR> <logCaptureFilter> [not the beta version or delimitation frozen, no need to capture log]
2020-03-06 19:20:46.733 879-996/? E/ScreemCommon: ### JankSchedHwRead error!
2020-03-06 19:20:46.734 879-996/? E/ScreemCommon: ### ScreemSchedDlmRead read failed!
2020-03-06 19:20:46.735 879-996/? E/ScreemCommon: ### ScreemSchedDlmRead error!
2020-03-06 19:20:46.737 879-996/? E/ScreemCommon: update dlm info failed
2020-03-06 19:20:46.996 2258-2450/? E/HwCHRWifiRSSIGroupSummery: updatArpSummery mRSSI:-1  HwCHRWifiRSSIGroup [rssi_index=4, rtt_tcp_packets=0, rtt_tcp_duration=0, rtt_lan_duration=5066, rtt_lan_failures=0, rtt_lan_succ=396, rtt_lan_max=324, rtt_lan_min=4,same_area_frequency=0,adjacent_area_frequency=0]
2020-03-06 19:20:47.212 2258-2258/? E/CHR_ChrModemStatistics: sensors invalid
2020-03-06 19:20:47.471 2334-17416/? E/AppInfoMgr: not find pkgs by uid: 0
2020-03-06 19:20:49.008 642-642/? E/WifiHAL: enter wifi_get_link_stats
2020-03-06 19:20:49.013 1408-1610/? E/WificondControl: Noise: 0, Snr: 0, Chload: -1
2020-03-06 19:20:49.393 1408-1431/? E/ActivityTaskManager: app boot failure event send
2020-03-06 19:20:49.443 879-3232/? E/LOGSERVER_UTILS: [ZeroHung]sentEvent: result->scope length:3, wpName length:2
2020-03-06 19:20:49.443 879-3232/? E/LOGSERVER_UTILS: [ZeroHung]sentEvent: recoverSolution length:10, recoverResult length:7, keyLog length:31
2020-03-06 19:20:49.479 879-3232/? E/iMonitor: [ZeroHung]appendFile: open /data/log/reliability/appeye/history.log.0 failed
2020-03-06 19:20:49.484 879-998/? E/ScreemHealth: Get an unregisted msg 3.
2020-03-06 19:20:49.512 1408-1587/? E/WindowManager: win=Window{c946538 u0 com.huawei.android.launcher/com.huawei.android.launcher.unihome.UniHomeLauncher} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=false win.mRemoveOnExit=false
2020-03-06 19:20:49.512 1408-1587/? E/WindowManager: win=Window{b8371be u0 com.huawei.android.launcher/com.huawei.android.launcher.unihome.UniHomeLauncher} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=false win.mRemoveOnExit=false
2020-03-06 19:20:49.533 2334-4108/? E/AwareLog: SPKSchedFeature: Uid has been sent, ignore.
2020-03-06 19:20:49.602 1408-1587/? E/ZRHungService: BF and NFW forceStop package: com.mycompany.myapp
2020-03-06 19:20:49.630 3259-3259/? E/NfcNci: NfcUtils error: APP do not have nfc permission
2020-03-06 19:20:49.637 1899-4895/? E/HsmCoreServiceImpl: onTransact in code is: 102
2020-03-06 19:20:49.637 2334-4531/? E/AwareLog: GameSdkConfigReader: GameSdkLog: idNameMap: null
2020-03-06 19:20:49.638 3259-3259/? E/NfcNci: NfcUtils error: APP do not have nfc permission
2020-03-06 19:20:49.652 21186-21228/? E/AppLifeChangeSensor: CAWARENESS: activityResumed mAppLifeChangeCallback is null 
2020-03-06 19:20:49.653 1899-11648/? E/DollieAdapterService: notifyActivityState pkg:com.huawei.android.launcher/com.huawei.android.launcher.unihome.UniHomeLauncher state:2 fg:true mUid:10074
2020-03-06 19:20:49.657 1408-1432/? E/WindowManager: icon is null!!
2020-03-06 19:20:49.832 838-838/? E/Thermal-daemon: [ap] temp_new :36  temp_old :37
2020-03-06 19:20:49.833 838-838/? E/Thermal-daemon: Report temperature: [ap] temp :36  report_threshold:1
2020-03-06 19:20:50.168 21235-14119/? E/TotemWeather: DeviceStateServiceListener:lastLocation is null

编辑1:

检查 Logcat 我可以猜测可能是“ZRHungService”导致了问题,但找不到有关此服务的任何信息。
E/ZRHungService: BF and NFW forceStop package: com.mycompany.myapp

编辑2:

我已经尝试在虚拟设备中成功调试,但问题是我正在将下载中的文件副本调试到缓存目录,而在虚拟设备中我没有该文件,所以我认为这不是一个选项: (

最佳答案

如果华为的任何人或他们的用户找到了真正的解决方案,我会遇到同样的问题。自从几天前更新到 Android 10 后,它才刚刚开始在我的 Mate 20 Pro 上发生。
这是我的应用程序的 logcat 行。在断点上 3-4 秒后死亡:

2020-03-10 20:22:24.228 711-981/? E/BufferQueueProducer: [Waiting For Debugger: digital.key.testapp#0]:1338: disconnect: not connected (req=1)
2020-03-10 20:22:24.249 1108-2438/? E/InputDispatcher: Window handle Window{b4506fa u0 Waiting For Debugger: digital.key.testapp} has no registered input channel
2020-03-10 20:22:24.422 8057-8106/digital.key.testapp E/AwareLog: AtomicFileUtils: readFileLines file not exist: android.util.AtomicFile@77e0f7
2020-03-10 20:22:30.622 1108-1817/? E/ZRHungService: BF and NFW forceStop package: digital.key.testapp
我找到了一个临时解决方案。在手机的开发人员选项中设置一个调试应用程序,并告诉它等待调试器。然后启动它,您可以从 Android Studio 附加调试器,一切正常。
  • 设置 -> 系统和更新 -> 开发者选项
  • 在调试下找到“选择调试应用程序”并选择您的应用程序
  • 勾选“等待调试器”
  • 从应用程序抽屉运行应用程序
  • 在 Android Studio 中选择附加调试器,断点不再崩溃

  • Dev Options Select debug app .

    关于Android Studio 调试器意外停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60569758/

    相关文章:

    ant - 在Android Studio上构建 Ant

    c++ - 不会被优化掉的最简单的 "unused"代码是什么?

    android - 如何解决 Android 应用程序中 tid 4504 (HeapTaskDaemon) 中的致命信号 11 (SIGSEGV)、代码 1 (SEGV_MAPERR)、故障地址 0x0

    java - Android DownloadManager 在某些情况下不起作用

    android - 从 Android Studio 中的外部项目链接模块

    c - GDB 脚本问题

    c++ - 调试时检查 map 的内容

    android - 如何防止 Android ImageView 与 TextView 重叠

    android - 约束布局 v1.1.0 : layout_constraintHorizontal_weight = 0 not working anymore

    android - Gradle:为什么加运算符会导致欺骗字符串连接?