I am new to android world.
I have made an application of a user registration. It was working fine. but when i tried to add a spinner to my activity file, it was showing an error in avd, like,
The Application Registration (Process com.students) has stopped unexpectedly. please try again
comes.
and my log cat is showing the error
"11-12 10:42:06.816: E/dalvikvm(313): Unable to open stack trace file '/data/anr/traces.txt': Permission denied"
What is actually that error? How can i get rid of that?
You are trying to access the external storage. Make sure you have necessary permission defined in your Manifest file. This can be done by adding
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
This error has nothing to do with your app. Its referring stack trace file that gets generated when your app crashes so the user can report it to the publisher. The reason you are seeing that error is that your app was not installed through the android market so it does not have permission to write to that file. Errors that your app is generating during debug can be seen in LogCat and a stack trace will be dumped there describing the error.
This was a problem I had when I was new to Android. Then I learned that the message about being unable to write to traces.txt was not the actual problem with the program.
The solution to this problem is thus to find and correct the actual (unrelated to this message) reason the program is crashing. Then this message (which reflects a configuration problem in the crash reporting system) will no longer occur.
The operation on /data/anr/traces.txt need root or system user chmod.
Ref ActivityManagerService#dumpStackTraces
code:
public static File dumpStackTraces(boolean clearTraces, ArrayList<Integer> firstPids,
ProcessCpuTracker processCpuTracker, SparseArray<Boolean> lastPids, String[] nativeProcs) {
String tracesPath = SystemProperties.get("dalvik.vm.stack-trace-file", null);
if (tracesPath == null || tracesPath.length() == 0) {
return null;
}
File tracesFile = new File(tracesPath);
try {
if (clearTraces && tracesFile.exists()) tracesFile.delete();
tracesFile.createNewFile();
FileUtils.setPermissions(tracesFile.getPath(), 0666, -1, -1); // -rw-rw-rw-
} catch (IOException e) {
Slog.w(TAG, "Unable to prepare ANR traces file: " + tracesPath, e);
return null;
}
dumpStackTraces(tracesPath, firstPids, processCpuTracker, lastPids, nativeProcs);
return tracesFile;
}
And I handle the problem in the shell as following.adb root
adb shell touch /data/anr/traces.txt
adb shell kill -3 ${APP_PID}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With