- // Write the logcat string to the output stream.
- outputStream.write(logcatString.toByteArray(StandardCharsets.UTF_8))
+ // Save the logcat using a coroutine with Dispatchers.IO.
+ CoroutineScope(Dispatchers.Main).launch {
+ withContext(Dispatchers.IO) {
+ // Write the logcat string to the output stream.
+ outputStream.write(logcatString.toByteArray(StandardCharsets.UTF_8))