gpt4 book ai didi

android - 无法在魅族 m3 note 上挂载 .obb 文件(state = 21)

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:07:14 29 4
gpt4 key购买 nike

我遇到了另一个关于 APK 扩展文件 (.obb-files) 的奇怪问题。我的扩展文件在我所有的测试设备上安装都很好:

  • 索尼 Xperia Z1 Compact(API 22)
  • 索尼 Xperia Z1 Ultra(API 22)
  • LG Nexus 5X(API 23)
  • LG Nexus 4(API 17)

我用 jobb-utilite 创建了加密的 .obb 文件:

jobb -o obb-filename -d files-dir -k password -pn applicationId> -pv versionCode

在我的应用程序中,我使用以下代码读取 .obb 文件:

public void initialize(final Context context) {
final StorageManager storageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
final File mainObbFile = getMainObbFile();

final OnObbStateChangeListener listener = new OnObbStateChangeListener() {
@Override
public void onObbStateChange(String path, int state) {
super.onObbStateChange(path, state);
if (state == OnObbStateChangeListener.MOUNTED) {
// work with obb file
} else {
throw new RuntimeException("OnObbStateChangeListener::onObbStateChange - can't mount .obb file (state = " + state + ").");
}
}
};

final String key = BuildConfig.MAIN_XAPK_KEY;
if (storageManager.isObbMounted(mainObbFile.getAbsolutePath())) {
// work with obb file
} else if (!storageManager.mountObb(mainObbFile.getAbsolutePath(), key, listener)) {
throw new RuntimeException("Can't create listener for mounting .obb file.");
}
}

一切正常。但是在魅族 m3 note (API 22) 上,我们得到了奇怪的错误:“OnObbStateChangeListener::onObbStateChange - can't mount .obb file (state = 21)”。

以前,我遇到过这个问题,并通过另一代 .obb 文件解决了。但在这种情况下,它没有帮助。此外,我尝试使用 fixed jobb 工具 ( https://github.com/monkey0506/jobbifier.git ) 生成 .obb 文件,但它不起作用。

可能有人知道,出了什么问题,为什么有时 .obb 文件在某些​​设备上不起作用?..

更新
另外,我检查了在魅族上安装非加密的 .obb 文件。有用。

提前致谢。

最佳答案

I had the same problem, and i figured out that many times Error 21 is caused by Linux Files Permissions over the obb, and the problem is that Android cannot have access to it so the StorageManager launches Error 21. When you create the .obb file, change permissions and user group to the file, something like:

$chmod 664 <obb-filename>.obb    
$chown user:group <obb-filename>.obb

然后再试一次,对我有用。

关于android - 无法在魅族 m3 note 上挂载 .obb 文件(state = 21),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40224768/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com