2017-09-25 21 views
0

这是发生在最终用户身上,我无法在我的终端上重现它。我不想试图通过安装devkit来讨论最终用户,以便他们可以查看LogCat,并且由于它是冻结而不是崩溃,因此没有“发送崩溃报告”类型的消息。如何为最终用户调试Android应用程序冻结,但不会崩溃

我只是运气好,直到我能弄清楚如何重现它?

回答

1

可以使用StrictMode用于检测可能存在的问题:

public void onCreate() { 
    if (DEVELOPER_MODE) { 
     StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() 
       .detectDiskReads() 
       .detectDiskWrites() 
       .detectNetwork() // or .detectAll() for all detectable problems 
       .penaltyLog() 
       .build()); 
     StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() 
       .detectLeakedSqlLiteObjects() 
       .detectLeakedClosableObjects() 
       .penaltyLog() 
       .penaltyDeath() 
       .build()); 
    } 
    super.onCreate(); 
}