Android Studio调试器意外停止

时间:2020-03-06 18:31:50

标签: android android-studio debugging

我无法调试我的应用程序,因为设置了断点后调试器停止了它,然后在两到三秒钟后突然停止,并且应用程序无故退出。

我尝试在不同位置设置断点,以确保没有其他后台进程对其进行干扰,例如在启动活动的onCreate刚开始时,但是同样发生的是,调试器按预期方式停止,并在几秒钟后停止应用程序退出,调试会话意外结束。

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

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

我的手机是Huawei 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:

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

2 个答案:

答案 0 :(得分:4)

如果华为的任何人或他们的用户找到了真正的解决方案,我也会遇到同样的问题。自从几天前将其更新为Android 10以来,它才刚刚在我的Mate 20 Pro上开始发生。

这是我的应用程序日志行。在断点处3-4秒后死亡:

  // labels (dates)
  var startDate = new Date('2019-10-01'), endDate = new Date('2019-10-10');
  var dt = new Date(startDate);
  let labels = new Array();
  while (dt <= endDate) {
    labels.push(new Date(dt));
    dt.setDate(dt.getDate() + 1);
  }

  const numbers = new Array();
  const numbers1 = new Array();

  // data for first line (just a horizontal line)
  for (var a = 0; a < 10; a++) {
    numbers.push(5);
  }

  // data for the second line, also a horizontal line but smaller
  for (var a = 0; a < 10; a++) {
    if (a == 3 || a == 7) {
      numbers1.push(6);
    } else {
      numbers1.push(null);
    }
  }


  this.canvas = document.getElementById('myChart');
  this.ctx = this.canvas.getContext('2d');

  // display chart
  const myChart = new Chart(this.ctx, {
    type: 'line',
    data: {
      labels: labels,
      datasets: [{
        label: 'Daily prices',
        data: numbers,
        fill: false,
        borderWidth: 2,
        borderColor: 'black'
      }, {
        label: 'Pattern',
        data: numbers1,
        fill: false,
        borderWidth: 2,
        borderColor: 'red'
      }]
    },
    options: {
      elements: {point: {radius: 0}},
      responsive: false,
      display: true
    }
  });
}

我找到了一个临时解决方案。在手机的devleoper选项中设置一个调试应用程序,并告诉它等待调试器。然后启动它,您可以从Android Studio附加调试器,并且一切正常。

  • 设置->系统和更新->开发者选项
  • 在“调试”下找到“ Sect调试应用”,然后选择“游览”应用
  • 勾选“等待调试器”
  • 从应用程序抽屉运行应用程序
  • 在Android Studio中,选择附加调试器,并且断点不再崩溃

Dev Options Select debug app

答案 1 :(得分:0)

华为Mate 20 Lite解决方案

我不知道这种方法如何以及为什么起作用,这不是科学方法。 对于那些无法使用Captain Wizard的解决方案的人,我发现了解决此问题的怪异方法。应该考虑上面提出的一些要求。

  1. 正常运行应用
  2. 以最快的速度转到“运行”->“附加到进程”。您必须从运行菜单中选择此选项,“将调试器附加到Android Process”,因为它不起作用。
  3. 出现一个弹出窗口,选择出现的选项。
  4. 有些事情终于出现了,不用注意了。
  5. 选择“将调试器附加到Android进程”图标。
  6. 现在,调试过程应在几秒钟后停止。