我想知道人们是否成功地在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尝试都):在Android中使用加密的OBB文件
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的开发者群体的问题here