I’ve a problem with that as well, because often even try/catch doen’t show the error in the console while crashing. I’ve tried to save the error/parameters as text, but it also didn’t work because the app crashed before catching. Saving can at least show until where the code did work properly, but it takes a considerable time and slows down the whole flow.
So I don’t have an answer but I solely respond because I don’t want The topic to die
I use it this way. This time the file will be written, but sometimes it doesn’t make it to the catch block.
Later on I will try to get your method working.
// !! Don't forget to give read/write permission !!
import android.os.Environment;
String path = new String(Environment.getExternalStorageDirectory().getAbsolutePath());
String[] my_parameters = new String[2];
// Do not write the parameters in try block
my_parameters[0] = "parameter a";
my_parameters[1] = "parameter b";
try {
int z = 5/0;
}
catch (Exception e) {
saveStrings(path+"/myErrorsLog.txt", my_parameters);
e.printStackTrace();
}