[英]My application is crashing without log cat exception or any error info?
返回START_STICKY后,我的應用程序立即崩潰。
我的應用程序中有一個前台服務:
public class MyService extends Service {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent != null) {
if (intent.getAction().equals(STARTFOREGROUND_ACTION)) {
// Code to create/update notification and start processing goes here
} else if (intent.getAction().equals(ANOTHER_ACTION)) {
// Code to create/update notification and do another processing
} else if (null != intent && intent.getAction().equals(STOPFOREGROUND_ACTION)) {
stopForeground(true);
stopSelf();
}
}
return START_STICKY; // Last reference point in debugger after which application crashes
}
}
我嘗試調試,只有調試的最后一點是返回START_STICKY; 專門用於STOPFOREGROUND_ACTION信號,之后它會崩潰。
沒有錯誤,應用程序日志中顯示警告,無法找出可能出了什么問題。
我該怎么做才能解決這個問題,因為我停止前台服務的方式是錯誤的,還有其他我可以做的事情來獲取更多應用特定日志。
我已經在捕獲異常並將其記錄如下的所有地方檢查了我的代碼:
try {
// Code expected to throw error or exception
} catch (Exception e) {
Log.e(TAG, Log.getStackTraceString(e));
}
在我沒有繞過異常的應用程序中,沒有地方可以緩存和記錄異常。
禁用所有過濾器並在log cat上選擇詳細選項時看到的一些錯誤:
1] `A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x10 in tid 32152 (Thread-1910)`
2] com.my.test.MyActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
com.my.test.MyActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
3] [Application Error: com.my.test](this:0xb28d3c00,id:809,api:1,p:933,c:252) new GraphicBuffer needed
4] I/WindowState: WIN DEATH: Window{41e99c5 u0 com.my.test.MyActivity}
由於沒有人回應,而且我設法找出了問題所在,所以問題出在
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x10 in tid 32152 (Thread-1910)
由於引用了MediaRecorder的服務用盡的線程而引起的。 我正在停止我的服務,如下所示:
stopForeground(true);
stopSelf();
哪種(以上)是停止服務的正確方法。 但是在停止服務之前,我已經釋放並停止了MediaRecorder。 由於在release(
)之后,服務之外的線程仍然可以通過服務外部的線程訪問MediaRecorder對象,因此任何MediaRecorder方法調用都會導致拋出以上錯誤,並且該錯誤與本機代碼(而非Java代碼)相關,因此很難跟蹤。 問題下面的錯誤檢查還有其他原因:
Android致命信號11(SIGSEGV)位於0x636f7d89(代碼= 1)。 如何找到它?
由於personne3000對這個問題的評論,我的問題得以解決。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.