我试图安装的扩展文件是这样的:
final StorageManager storageManager = (StorageManager) getSystemService(STORAGE_SERVICE);
String obbPath = Environment.getExternalStorageDirectory() + "/Android/obb";
final String obbFilePath = obbPath + "/com.example/main.1.com.example.obb";
storageManager.mountObb(obbFilePath, "SecretKey", new OnObbStateChangeListener() {
@Override
public void onObbStateChange(String path, int state) {
super.onObbStateChange(path, state);
if (state == OnObbStateChangeListener.MOUNTED) {
onObbMounted();
} else {
Log.d("##", "Path: " + path + "; state: " + state);
}
}
});
但在运行时我得到国家21:ERROR_COULD_NOT_MOUNT:
Path: /storage/sdcard0/Android/obb/com.example/main.1.com.example.obb; state: 21
我已经添加了这一点:
File f = new File(obbFilePath);
if (!f.exists()) {
Log.e("OBB", "FILE NOT FOUND!!!");
}
和logcat的说,文件存在。 我不知道,为什么我能得到这个国家21?