我想知道人们是否成功地在Android中创建/加载加密的OBB(不透明二进制Blob)文件?这是对此question的跟进 1:What is OBB(Opaque Binary Blob) in Android develop site?,按照该帖子中的指示执行以下操作(从ICS 4.01基线开始,在Ubuntu 10.10-32bit和Ubuntu 12.4-64bit上尝试):
sudo modprobe cryptoloop
sudo modprobe twofish
sudo modprobe vfat
./mkobb.sh -d /tmp/obb/ -kblahblah -o /tmp/out.obb -v
obbtool a -n com.test.blah -v 1 -s 997ff9b1516a6788 /tmp/out.obb # 997ff... is the salt from the mkobb step
obbtool i /temp/out.obb # verify the obb file
adb push /temp/out.obb /sdcard/
从这里我将out.obb文件复制到手机上的/ sdcard /。并使用以下代码进行安装:
String obbFile = Environment.getExternalStorageDirectory() + "/out.obb";
mgr = (StorageManager) getSystemService(Context.STORAGE_SERVICE); // mgr is a member varible of my main activity
Log.i("OBB", "trying to mount : " + obbFile + " does it exist? " + new File(obbFile).exists());
if (mgr.mountObb(obbFile, "blahblah", new OnObbStateChangeListener(){
@Override
public void onObbStateChange(String path, int state) {
Log.i("OBB", String.format("onObbStateChange:Path [%s] State=%d", path, state));
if (state == OnObbStateChangeListener.ERROR_COULD_NOT_MOUNT){
Log.i("OBB", "THIS IS THE ERROR I GET");
}
}}))
{
Log.i("OBB", "Attempting to mount");
} else {
Log.i("OBB", "Mount failed"); // this isn't happening
}
最终结果是:
E/MountService( 2004): Couldn't mount OBB file: -1
I/OBB (21219): onObbStateChange:Path [/mnt/sdcard/out.obb] State=21
I/OBB (21219): THIS IS THE ERROR I GET
有人发现此问题吗?好像它应该有效!
注意:我确实有android.permission.WRITE_EXTERNAL_STORAGE,我也可以从以下网站获得预期信息:
ObbInfo info = ObbScanner.getObbInfo("/sdcard/out.obb"); // this returns expected info, so the file is there and able to be read.
修改:链接到Android-Developer群组问题here
答案 0 :(得分:1)
您应首先格式化使用obb文件(out.obb)创建的虚拟设备(设备映射设备),然后才能安装它。
具体来说,你应该在VolumeManager :: mountObb()中添加一些代码。
if (Fat::format(dmDevice, 0)) {
SLOGE("OBB FAT format failed (%s)", strerror(errno));
return -1;
}
也许这是android的错误?