My (self-developed) Sudoku application generated an IOException (EACCES (Permission denied)) when I started using an API 35 emulated device in Android Studio. The problem did not occur using an API 34 emulated device. The problem occurred (among other places) in the following function when calling context.openFileOutput():
void save(Context context, String fileName) {
// Write the field as XML.
String xmlFileName = fileName.endsWith(EXT_XML) ? fileName : fileName
+ EXT_XML;
FileOutputStream xmlFos;
try {
xmlFos = context.openFileOutput(xmlFileName, Context.MODE_PRIVATE);
} catch (IOException ex) {
throw new RuntimeException(ex.getMessage());
}
serializeXml(xmlFos);
}
My (self-developed) Sudoku application generated an IOException (EACCES (Permission denied)) when I started using an API 35 emulated device in Android Studio. The problem did not occur using an API 34 emulated device. The problem occurred (among other places) in the following function when calling context.openFileOutput():
void save(Context context, String fileName) {
// Write the field as XML.
String xmlFileName = fileName.endsWith(EXT_XML) ? fileName : fileName
+ EXT_XML;
FileOutputStream xmlFos;
try {
xmlFos = context.openFileOutput(xmlFileName, Context.MODE_PRIVATE);
} catch (IOException ex) {
throw new RuntimeException(ex.getMessage());
}
serializeXml(xmlFos);
}
Share Improve this question edited Mar 30 at 11:01 David Singleton asked Mar 30 at 10:15 David SingletonDavid Singleton 1246 bronze badges1 Answer
Reset to default 0I found the cause using the Android ADB shell function. I had uploaded a series of test files to the emulated device using a script I had developed. When I listed the files using the shell, I noticed that group access was only 'r' - readable. Changing the group access to 'rw' with the following command in the ADB shell solved my problem.
chmod g+w *
Obviously there has been some internal change in the Android OS between API 34 and API 35 that has resulted in my problem.