我想测试扩展包文件(OBB)在Android的下莅临指导: http://developer.android.com/google/play/expansion-files.html
I'm trying to test the Expansion Pack Files (OBB) In Android following the guide here: http://developer.android.com/google/play/expansion-files.html
我在哪里,我需要测试我的Nexus 4我的应用程序的步骤。
I'm in the step where I need to test my app on my Nexus 4.
我产生我的.obb文件jobb和亚行推的装置在以下位置:
I generated my .obb file with jobb and adb-pushed it in the device in this location:
/mnt/shell/emulated/0/Android/obb/my.package/main.1.my.package.obb
在应用程序运行它没有找到该文件。
When the app run it doesn't find the file.
方法:
Helpers.doesFileExist(context, fileName, xf.mFileSize, false)
返回false我的文件。
return false for my file.
我调试,发现它正在寻找的文件:
I debugged and found out it is looking for the file in:
/storage/emulated/0/Android/obb/my.package/main.1.my.package.obb
具体而言,这是通过返回的路径:
Specifically this is the path returned by:
Helpers.generateSaveFileName(c, fileName)
本/存储/模拟/ 0,由Environment.getExternalStorageDirectory()返回不存在浏览器与亚行的shell。
The /storage/emulated/0, returned by Environment.getExternalStorageDirectory() doesn't exist browsing the device with adb shell.
但它在运行时,应用程序里面,我也查了一下它包含的:它几乎包含了我发现的/ mnt /壳一样的东西/模拟/ 0,它包含了Android / OBB目录,里面是空的。
But it DOES at runtime, inside the app, I also checked what it contains: it contains almost the same things I found in /mnt/shell/emulated/0, it contains the Android/obb dir, which is empty.
如何发现的路径/mnt/shell/emulated/0/Android/obb/my.package/main.1.my.package.obb在我放OBB文件:
How I found out the path /mnt/shell/emulated/0/Android/obb/my.package/main.1.my.package.obb where I placed my obb file:
$ adb shell
$ ls -ld sdcard
lrwxrwxrwx root root 2013-10-16 17:34 sdcard -> /storage/emulated/legacy
$ ls -ld /storage/emulated/legacy
lrwxrwxrwx root root 2013-10-16 17:34 legacy -> /mnt/shell/emulated/0
和里,我已经找到了Android / OBB目录,空的。
And inside that I already found the Android/obb directory, empty.
所以现在的问题是:我应该在哪里把我的OBB文件,它在运行时的正确位置
So the question is: where should I put my obb file for it to be in the right position at runtime?
我做的一切都是有说:
建立在市场上的应用程序草案获得公共密钥
created a draft application in the Market to get the public key
生成的随机排列的20个字节(盐)
generated a random array of 20 byte (salt)
综合play_licensing /库和play_apk_expansion / download_library
integrated play_licensing/library and play_apk_expansion/download_library
写我的服务/接收
确实使用助手等检查..完全一样的文件说。
did the check using the Helpers etc.. exactly like the documentation say.
我想一切正常,但我不能只是还没有发布关于Play商店!我需要本地测试,我将有必要经常改变我的OBB文件pretty的在发展的初始阶段。
I suppose everything works but I can't just yet release on Play Store! I need to test locally and I'll have the need to change my obb file pretty often in this initial phase of development.
我不能在模拟器上测试,因为我使用3D和设备的摄像头。
I can't test on the Emulator because I use 3D and device camera.
由于Android 4.2的多用户支持已被添加。
Since Android 4.2 multi users support have been added.
要支持Android的安装一个模拟磁盘作为各地的实际文件系统中的沙箱层中每个用户。这让Android的得体的处理或者共享用户无论是个人文件之间的文件
To support that Android mount an emulated disk for each users acting as a sandbox layer around the actual filesystem: this let Android handle gracefully either sharing of files between users either personal files.
长话短说:
/storage/emulated
是仿真文件系统。
is the emulated filesystem.
如果你进入亚行的shell该目录中,你可能会看到一个
if you enter that directory from adb shell you may see a
/storage/emulated/obb
目录。有时不显示,由于某种原因(见下文做什么,如果发生这种情况)
directory. Sometimes it doesn't show up, for some reason (see below for what to do if this happen)
这不是在/安卓/ OBB,但是这是正确的目录下,以将您的应用程序包/ OBB文件!
It's not in /Android/obb but that's the right directory where to place your app package / obb file!
如果您没有看到该目录尝试寻找的:
/mnt/shell/emulated/obb
您应该可以把你的文件存在。
You should be able to put your file there.
这将是正确拾起在运行时,在结束
It will be correctly picked up at runtime ending at the
/storage/emulated/0/Android/obb/my.package/main.1.my.package.obb
路径。
我觉得Android的文件应说明这一点。
I think the Android documentation should explain this.
(我回答我的问题,因为我找到了如何解决它,而写它。)
(I answer my own question because I found out how to solve it while writing it.)