Reputation: 703
So the problem I'm having is extremely simple and I can't seem to figure it out. When I place my expansion file, or .obb file main.2.com.example.project.obb
inside the obb directory, like so:
/storage/emulated/0/Android/obb/main.2.com.example.project.obb
Everything works perfectly. I am able to access my files, or unzip the obb, or whatever I need. However, if I place it inside:
/storage/emulated/0/Android/obb/com.example.project/main.2.com.example.project.obb
It cannot find my file, which is a problem. I'm only testing now, but when I publish this to the playstore it will create that sub directory for me and place the file inside. As it always does. Why on earth is it unable to find the sub directory/files inside my Android/obb directory?
Here is the error
12-15 16:59:30.862: W/System.err(4483): java.io.FileNotFoundException: /storage/emulated/0/Android/obb/com.example.project/main.2.com.example.project.obb: open failed: ENOENT (No such file or directory)
12-15 16:59:30.863: W/System.err(4483): at libcore.io.IoBridge.open(IoBridge.java:456)
12-15 16:59:30.863: W/System.err(4483): at java.io.FileInputStream.<init>(FileInputStream.java:76)
12-15 16:59:30.863: W/System.err(4483): at java.io.FileInputStream.<init>(FileInputStream.java:103)
Again the only difference in code is appending the sub directory, everything else is exactly the same. Any help is appreciated, hoping I missed something simple and its a quick easy fix. (fingers crossed).
EDIT
So I just tried placing it inside a directory called "a", and it worked. So this:
/storage/emulated/0/Android/obb/a/main.2.com.example.project.obb
Works perfectly as well. Am I supposed to be escaping my stops (" . " / periods / dots)? Ive never seen it be a problem before.
Upvotes: 1
Views: 4078
Reputation: 703
The device I was attempting to use this on was a nexus 7 (2013) with the 5.0 (lollipop) OS. I was never able to read contents from my manually created <package-name>
sub directory. Further more I was never able to read anything from any directory inside Android/obb that had a period/stop in it. However when I took a leap of faith and published it to beta on the Playstore the code worked. For some reason when the Playstore created the <package-name>
sub directory inside Android/obb it was able to find the contents. Doesn't make sense to me, but until there is a better answer on this thread I figured I would at least share my experience/result.
Upvotes: 1