Unknown bug "Thread starting during runtime shutdown"

I had the same issue...

I have updated the fabric plugin, then updated the twitter sdk..

then clean my project and rebuild the apk..my error has been gone.

some time this error occurred while some ANR occurs.


The current thread is started too late, that is, when you receive an uncaught exception in the UncaughtExceptionHandler, a child thread is started to upload the error log. HttpClient is created when the error log is uploaded, but ThreadSafeClientConnManager was set to manage the connection when created.

By viewing the source code of ThreadSafeClientConnManager, it was found that ThreadSafeClientConnManager also opened child threads, which caused the problem of opening child threads in child threads, which would cause uncaughtException () in the thread after execution was completed Only when the thread is started, java.lang.InternalError: Thread starting during runtime shutdown will be thrown.

The solution to this problem is: Create HttpClient in advance, because HttpClient creation will also start the thread, avoid creation in uncaughtException (), thereby avoiding the problem of starting the thread in the thread.

Alternative solution: Remove UncaughtExceptionHandler from your code in case it tried to create a thread.