简体   繁体   English

Android Studio 调试器意外停止

[英]Android Studio debugger stops unexpectedly

I'm not being able to debug my app as after setting a breakpoint and debugger stops at it, it then stops suddenly after two or three seconds and app exits with no aparent reason.我无法调试我的应用程序,因为在设置断点和调试器停止之后,它会在两三秒后突然停止并且应用程序无缘无故退出。

I've tried setting the breakpoint at different locations to ensure no other background process is interfering with it, for example at the very beginning of onCreate in splash activity, but the same happens, debugger stops as expected and after a few seconds app exits and debugging session ends unexpectedly.我已经尝试在不同的位置设置断点以确保没有其他后台进程干扰它,例如在启动活动的 onCreate 开始时,但同样发生,调试器按预期停止,几秒钟后应用程序退出并调试会话意外结束。

I've tried updating Android Studio and Gradle to latest version (my AS is 3.6.1) and Gradle 5.6.4 (plugin version is 3.6.1) to no avail.我已经尝试将 Android Studio 和 Gradle 更新到最新版本(我的 AS 是 3.6.1)和 Gradle 5.6.4(插件版本是 3.6.1),但无济于事。 Also tried uninstalling/reinstalling the app to no avail too and lastly I've tried "Invalidate caches and restart" option in Android Studio but it neither worked.还尝试卸载/重新安装应用程序也无济于事,最后我在 Android Studio 中尝试了“使缓存无效并重新启动”选项,但它都不起作用。

I'm not being able to debug and don't know what else to try / do.我无法调试,也不知道还能尝试/做什么。

My mobile is a Huawei Mate 20 Lite, and I've also tried rebooting the phone with no success.我的手机是华为 Mate 20 Lite,我也试过重启手机,但没有成功。

Here is my "Logcat" as soon as debugger stops and app exits (app figures as com.mycompany.myapp):这是调试器停止和应用程序退出后的“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

Edit 1:编辑1:

Inspecting Logcat I can guess that maybe "ZRHungService" is causing the problem, but cannot find any information about this service.检查 Logcat 我可以猜测可能是“ZRHungService”导致了问题,但找不到有关此服务的任何信息。

E/ZRHungService: BF and NFW forceStop package: com.mycompany.myapp

Edit 2:编辑2:

I've tried debugging in a virtual device with success, but the problem is I'm debugging the copy of a file in downloads to cache dir and in virtual device I don't have that file, so I think that's not an option :(我试过在虚拟设备中调试成功,但问题是我正在调试下载中的文件副本到缓存目录,而在虚拟设备中我没有那个文件,所以我认为这不是一个选项: (

I am getting the same issue if anyone from Huawei, or users of them have found real solutions yet.如果来自华为的任何人或他们的用户找到了真正的解决方案,我就会遇到同样的问题。 It's only just started happening on my Mate 20 Pro since it was updated to Android 10 a few days ago.自从几天前更新到 Android 10 以来,它才刚刚开始发生在我的 Mate 20 Pro 上。

Here are my logcat lines for the app.这是我的应用程序 logcat 行。 Dies after 3-4 secs of being on a breakpoint :在断点上 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

I have found one temporary solution.我找到了一种临时解决方案。 Set a debug app in your devleoper options on your phone and tell it to wait for debugger.在手机的 devleoper 选项中设置一个调试应用程序,并告诉它等待调试器。 Then launch it and you can attach the debugger from Android Studio and all works well.然后启动它,您可以从 Android Studio 附加调试器,一切正常。

  • Settings -> System and Updates -> Developer Options设置 -> 系统和更新 -> 开发者选项
  • Under Debugging find 'Sect debug app' and choose tour app在调试下找到'Sect debug app'并选择tour app
  • Tick ON 'Wait for dbugger'勾选“等待 dbugger”
  • Run app from app drawer从应用程序抽屉运行应用程序
  • In Android Studio choose attach debugger instead and breakpoints no longer crash在 Android Studio 中选择附加调试器,断点不再崩溃

开发选项 选择调试应用 . .

Huawei Mate 20 Lite solution华为Mate 20 Lite解决方案
I don't know how and why does this work, it's not a scientific method.我不知道这如何以及为什么起作用,这不是一种科学方法。 For those who doesn't work Captain Wizard's solution, I have found a weird approach for this issue.对于那些不使用巫师船长解决方案的人,我发现了一个解决这个问题的奇怪方法。 Some requirments presented above should be considered.应考虑上述一些要求。

  1. Normal run the app正常运行应用
  2. As fast as you can, go to Run -> Attach to process.. You have to choose this option from the run menu, NOT "Attach Debugger to Android Process" as it will not work.尽可能快地转到运行 -> 附加到进程。您必须从运行菜单中选择此选项,而不是“将调试器附加到 Android 进程”,因为它不起作用。
  3. A pop-up appears, choose the option that appears.出现一个弹出窗口,选择出现的选项。
  4. Something finally shows up, don't pay attention to it.终于有东西出现了,别在意。
  5. Choose "Attach Debugger to Android Process" icon.选择“将调试器附加到 Android 进程”图标。
  6. Now, the debugging process should not stop after a few seconds.现在,调试过程不应在几秒钟后停止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM