The exception only occurs in Android 7.0 Nougat (emulator) devices.
java.lang.SecurityException: MODE_WORLD_READABLE no longer supported
World-readable files can be a security flaw. So android first deprecated it and then completely removed it. MODE_WORLD_READABLE
was deprecated in versions till Android M
. But in Android N
it is no longer supported and throws SecurityException
. So try a different mode. I used Context.MODE_PRIVATE
and it worked.