2017-10-14 44 views
0

我的应用程序在返回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)); 
     } 

在我绕过例外,他们被缓存并记录处处应用的地方。

一些我看的时候关闭所有过滤器并选择在日志猫详细选项的错误:

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

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}

回答

0

由于没有人回应,我设法找出问题,问题是

A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x10 in tid 32152 (Thread-1910) 

由于线程用尽了对MediaRecorder的引用服务。我正在停止我的服务如下:

stopForeground(true); 
stopSelf(); 

哪个(上图)是停止服务的正确方法。但在停止服务之前,我正在发布并停止MediaRecorder。由于MediaRecorder对象仍然可以在release(之后被线程外部服务访问),所以任何MediaRecorder方法调用都会导致上述错误被抛出,并且与本机代码而不是Java代码相关,因此很难追查到。还有其他原因,下面的问题这个错误检查:

Android Fatal signal 11 (SIGSEGV) at 0x636f7d89 (code=1). How can it be tracked down?

我的问题,因为personne3000this问题提出意见的解决。

相关问题