I'm having an issue with an app: (rarely) a user will download the app from the play store but the obb/expansion file will fail to download. If the folder for the obb file is created (Android/obb/my.package.name
), that's fine, I can manually download the obb file without a problem.
However, if the folder for the obb file was not created, attempting to create it with File::mkdir()
or File::mkdirs()
fails (returns false). Attempting to create and write to the obb file without a directory throws a FileNotFoundException
.
File obbFile = new File("path/to/obb/file.obb");
File parent = obbFile.getParentFile();
if (!parent.exists() && !parent.mkdir()) {
// Failed to create directory
}
External read/write permissions are set up and working correctly as we can read/write/create other files/directories with no issue.
I've read How to create a folder under /Android/obb? but the only solution given to that is to drop the target sdk to 22.
Has anyone else come across this and found a solution or workaround?