I'm trying to get the log of my app. Android 4.1.2 (Huawei tablet)
This is the code that I'm using
StringBuilder log=new StringBuilder();
try {
Process process = Runtime.getRuntime().exec("logcat -d");
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = bufferedReader.readLine()) != null) {
log.append(line);
log.append(System.getProperty("line.separator"));
}
System.out.println(line == null);
} catch (IOException e) {
System.out.println("error");
e.printStackTrace();
}
I have added ther permissions to manifest
<uses-permission android:name="android.permission.READ_LOGS" />
When I try to read it bufferedReader
is null and nothing is added to log
variable.
EDIT:
I've founded this info
Apparently Huawei devices have service loggin disabled by default. I've tried the solution of the post but it doesn't work for me because "service loggin" option doesn't appears
Can someone help me?
Thanks