gpt4 book ai didi

找不到 Android 原始资源

转载 作者:搜寻专家 更新时间:2023-11-01 07:40:43 27 4
gpt4 key购买 nike

我通过创建文件夹 res/raw/myfile 然后使用代码来使用原始资源InputStream = Resources.getSystem().openRawResource(R.raw.myfile);

此代码抛出资源未找到异常,并在日志中显示“资源不包含资源编号 0x7f04000 的包”

根据我的猜测,我上面使用的代码是正确的。我见过的所有其他示例都是不可能的 (2.1 sdk),因为它们可能是旧示例。

我已经清理、构建并使用了新的 avd。我的 R.java 看起来像这样公共(public)静态最终类原始{ 公共(public)静态最终 int myfile=0x7f040000;

最佳答案

试试这个方法。

  InputStream is = getResources().openRawResource(R.raw.myfile);

关于找不到 Android 原始资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4008495/

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