Error: Expected resource as type raw, current resource is not of that type.
发布时间
阅读量:
阅读量
问题
在工程实践中,存在一种技术手段,即将drawable格式的图像资源作为输入流进行处理和应用:
InputStream inputStream = getResources().openRawResource(R.drawable.guide1);
在使用debug包的过程中未出现任何异常,然而当进行release包的构建时却遭遇打包失败的情况,并伴随如下提示信息:
Error: Expected resource of type raw [ResourceType]
然而从代码层面观察,尽管函数的命名是openRawResource,但实际上该函数完全可以用于设置drawable类型的资源。
/** * Open a data stream for reading a raw resource. This can only be used
* with resources whose value is the name of an asset files -- that is, it can be
* used to open drawable, sound, and raw resources; it will fail on string
全部评论 (0)
还没有任何评论哟~
