Expansion file - can't load .obb from /sdcard/Android/obb/ on Android 4.2
Use monitor (Android Debug Monitor) to put expansion files on your device for testing.
My experience with a Nexus 7 (not rooted) using: command line adb vs monitor (Android Debug Monitor)gui:
1) adb push main.1.com.mypackage.obb /sdcard/Android/obb/com.mypackage/main.1.com.mypackage.obb
looked successful. However the app could not find the expansion file, and a file explorer on the device could not display the file. note:the device was not rooted and I could not run adb root.
2) using the monitor gui - start from command line with: ../sdk/tools/monitor Using the monitor gui showed that the /sdcard location actually pointed to several different file links. In order for the app to see the expansion file I had to put the expansion file to the proper linked file location - in my case this was /mnt/shell/emulated/obb/com.mypackage - which adb shell still did not show, however the apps on the device could reach the file.
Nicolas Lauquin
Updated on June 04, 2020Comments
-
Nicolas Lauquin about 4 years
I'm developping the obb integration for the "expansion files". I made it worked in local by copying the .obb file on the sdcard of the device (4.1) but on my 4.2 devices it is not working anymore.
1) On 4.1 tablet: it's working well. I pushed my extension pack file using an adb command on a tablet and then I'm able to find the file and read it :
adb push main.1.mypackage.obb /sdcard/Android/obb/mypackage/ shell@android:/sdcard/Android/obb/mypackage/ $ ls -al -rw-rw-r-- root sdcard_rw 20314171 2013-08-05 18:01 main.1.mypackage.obb
2) On 4.2 : the same procedure as above, the file is not "visible", both exists() and canRead() methods on the main activity return false.
adb push main.1.mypackage.obb /sdcard/Android/obb/mypackage/ shell@android:/sdcard/Android/obb/mypackage/ $ ls -al -rw-rw-r-- root sdcard_rw 20314171 2013-08-05 18:54 main.1.mypackage.obb
Solution : From there, I investigated using the app "Android File Transfer" and I found that the obb folder is empty from the tool… so it is not the same folders I push the data into…
I uploaded the .obb using the app "Android File Transfer" and then it is working… But in that case I don't know where the file are stored (not on the sdcard, I guess ??)
So guys, what I need to change on 4.2 for accessing my .obb file? Thanks in advance
Extra informations:
a) I made a basic test to check the file existance using "file.exists() + " canRead=" + file.canRead()" with Environment.getExternalStorageDirectory :
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/obb/packagename/main.1.packagename.obb");
b) The procedure is scripted so the issue is not coming from a manual mistake (and triple check everythings)
EDIT
c) To sum up :
With "adb push" on 4.2 it is working for "normal" data: If I put a folder with images in /sdcard/myfolder/ it is working but not below /sdcard/android/.
The Android File Transfer shows a "Android/obb" folder at the root and .obb files are visible from the code in that case but:
- I cannot confirm it is on the /sdcard from the 'Android File Transfer App', what is disturbing me is that doing an "adb shell ls /sdcard/Android/obb" display that the folder is empty…
- I cannot use the same script for 4.1 and 4.2, validate the production procedure and use it in dev to save a lot of time with a light apk (and save time on build & deployment time)…
SOLUTION USED INTERNALLY
For < 4.1
adb push main.1.mypackage.obb /sdcard/Android/obb/mypackage/
For >= 4.2
adb push main.1.mypackage.obb /mnt/shell/emulated/obb/mypackage/
-
Nicolas Lauquin almost 11 yearsFor now, on Android 4.2 I'm using the Android File Transfer to validate the fonctionality and not the adb push which is not working. I have a workaround so I'm focusing on the next steps…
-
uncle Lem almost 11 years@Gros try to use Android Monitor from SDK to push .obb into
/sdcard/
folder. And, BTW, does your 4.2 device even have an SD card? =) -
Nicolas Lauquin almost 11 yearsI guess it is a "safe guard" but I found no documentation about it. You provide a reference to the documentation that I followed but I didn't see any "more information" about this, can you quote which part talk about protections?