Reputation: 559
I used to collect ANR info by reading and analysing /data/anr/traces.txt programmatically. It works very well before Android N.
On Android N, "/data/anr/traces.txt" is NOT accessible.
File anrFile = new File("/data/anr/traces.txt");
if (anrFile.exists()) {
boolean read = anrFile.canRead(); //always FALSE
}
My question:
How can my app access traces.txt on Android N ?
How can my app get its ANR info on Android N ?
Upvotes: 3
Views: 2094
Reputation: 1745
I'm not sure if this is an Android N specific issue as it appears to be more generic. The directory /data/anr or the files in this directory are often readable only by the root user. And thus, when devices is not rooted, we can't get ANR from the files.
However, from the Android documentation (bug-report adb documentation), you can receive the bugreports using this adb command line:
adb bugreport E:\Reports\MyBugReports
The final argument is the path where you want the bugreport to be copied on your local computer.
Upvotes: 2