Prior to API 25, it was no problem saving a file to the private app storage. However, with compileSdkVersion and targetSdkVersion set to 25, this is not possible - whenever I am trying to read/write a file (which is in the app-private storage), I get PERMISSION_DENIED and my app crashes.
Example 1: This is the exception Realm throws upon calling Realm.getDefaultInstance():
io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/[PACKAGE_NAME]/files/default.realm.management'. Please use a path where your app has read-write permissions. in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 81 Kind: PERMISSION_DENIED.
Example 2: This is the exception the app throws upon trying to persist a file (while opening FileOutputStream):
java.io.FileNotFoundException: /data/user/0/[PACKAGE_NAME]/files/[FILE_NAME] (Permission denied)
As already said, I have none of these issues on API 24. Does somebody have an idea what the possible cause of this problem is?
Your app lost its ability to work with its own files. Possible reasons include:
Because you changed the android:sharedUserId
value for your app — if you ever add/change/remove this attribute in the manifest, you have to fully uninstall and reinstall the app
Something to do with multiple user accounts on the device on which you are testing, perhaps tied into...
...Some bug in Android that you accidentally tripped over