[2010-12-31 21:33:29 - s] W/ResourceType(27930): Unable to get buffer of resourc_移动开发_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > 移动开发 > [2010-12-31 21:33:29 - s] W/ResourceType(27930): Unable to get buffer of resourc

[2010-12-31 21:33:29 - s] W/ResourceType(27930): Unable to get buffer of resourc

 2011/1/1 9:07:56  cqfly  http://cqfly.javaeye.com  我要评论(0)
  • 摘要:<scripttype="text/javascript"><!--document.body.oncopy=function(){if(window.clipboardData){setTimeout(function(){vartext=clipboardData.getData("text");if(text&&text.length>300){text=text+"\r\n\n本文来自CSDN博客,转载请标明出处:"+location.href
  • 标签:2010

<script type="text/javascript"><!-- document.body.oncopy = function () { if (window.clipboardData) { setTimeout(function () { var text = clipboardData.getData("text"); if (text && text.length > 300) { text = text + "\r\n\n本文来自CSDN博客,转载请标明出处:" + location.href; clipboardData.setData("text", text); } }, 100); } } // --></script><script type="text/javascript"><!-- function StorePage() { d = document; t = d.selection ? (d.selection.type != 'None' ? d.selection.createRange().text : '') : (d.getSelection ? d.getSelection() : ''); void (keyit = window.open('http://www.365key.com/storeit.aspx?t=' + escape(d.title) + '&u=' + escape(d.location.href) + '&c=' + escape(t), 'keyit', 'scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes')); keyit.focus(); } // --></script>

?

Problems ?
When building you might run into the Unable to get buffer of resource asset file error. The root cause of this is that the new android resource file resources.arsc is larger than the aapt tool allows. You can exchange the .arsc file inside android.jar with an older version or patch the aapt tool by editing frameworks/base/include/utils/Asset.h.

Change both lines UNCOMPRESS_DATA_MAX = 1 * 1024 * 1024 to something bigger. As the new resources file currently has a size of 2.3Mb you should change the lines (both lines mind you) to at least 3*1024*1024.

在使用linux下面默认选项build出来的SDK作开发时候,出现了以下问题:

...Unable to get buffer of resource asset file

[2010-12-31 21:33:29 - s] W/ResourceType(27930): Unable to get buffer of resource asset file
[2010-12-31 21:33:29 - s] /home/xiongmc/workspace/s/res/layout/main.xml:2: error: No resource identifier found for attribute 'orientation' in package 'android'
[2010-12-31 21:33:29 - s] /home/xiongmc/workspace/s/res/layout/main.xml:2: error: No resource identifier found for attribute 'layout_width' in package 'android'
[2010-12-31 21:33:29 - s] /home/xiongmc/workspace/s/res/layout/main.xml:2: error: No resource identifier found for attribute 'layout_height' in package 'android'
[2010-12-31 21:33:29 - s] /home/xiongmc/workspace/s/res/layout/main.xml:7: error: No resource identifier found for attribute 'layout_width' in package 'android'
[2010-12-31 21:33:29 - s] /home/xiongmc/workspace/s/res/layout/main.xml:7: error: No resource identifier found for attribute 'layout_height' in package 'android'
[2010-12-31 21:33:29 - s] /home/xiongmc/workspace/s/res/layout/main.xml:7: error: No resource identifier found for attribute 'text' in package 'android'
[2010-12-31 21:33:29 - s] /home/xiongmc/workspace/s/AndroidManifest.xml:2: error: No resource identifier found for attribute 'versionCode' in package 'android'
[2010-12-31 21:33:29 - s] /home/xiongmc/workspace/s/AndroidManifest.xml:2: error: No resource identifier found for attribute 'versionName' in package 'android'
[2010-12-31 21:33:29 - s] /home/xiongmc/workspace/s/AndroidManifest.xml:6: error: No resource identifier found for attribute 'icon' in package 'android'
[2010-12-31 21:33:29 - s] /home/xiongmc/workspace/s/AndroidManifest.xml:6: error: No resource identifier found for attribute 'label' in package 'android'
[2010-12-31 21:33:29 - s] /home/xiongmc/workspace/s/AndroidManifest.xml:7: error: No resource identifier found for attribute 'name' in package 'android'
[2010-12-31 21:33:29 - s] /home/xiongmc/workspace/s/AndroidManifest.xml:7: error: No resource identifier found for attribute 'label' in package 'android'
[2010-12-31 21:33:29 - s] /home/xiongmc/workspace/s/AndroidManifest.xml:10: error: No resource identifier found for attribute 'name' in package 'android'
[2010-12-31 21:33:29 - s] /home/xiongmc/workspace/s/AndroidManifest.xml:11: error: No resource identifier found for attribute 'name' in package 'android'
[2010-12-31 21:33:29 - s] /home/xiongmc/workspace/s/AndroidManifest.xml:16: error: No resource identifier found for attribute 'minSdkVersion' in package 'android'

解决办法是将build sdk时候的product该为sdk,有两种方法 ?:

1. 使用lunch更改配置:

cd ~/android/src
. build/envsetup.sh
lunch sdk-eng
make sdk

配置之后的结果是:

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=1.6
TARGET_PRODUCT=sdk
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=Donut
============================================

2. 直接用make参数:

make PRODUCT-sdk-sdk


Asset限制文件大小UNCOMPRESS为1MB ?

  在使用Android自带的 Res\raw或使用Asset时都需要经过Asset Manager,这将会产生一个比较严重的问题,在Android模拟器测试时不存在问题,但放到真机G1时会面临多个问题,经过查看 UNCOMPRESS_DATA_MAX的取值为1048576字节,除以1024不难发现是1MB。也就是说Android手机在处理资源文件时不能大 于1mb的体积。由于标准的G1没有Root权限,无法访问data/data/package name下面的文件夹,使用raw或asset存放的文件大小不能超过1048576字节,否则会在logcat下看到获取到Debug类型的信 息,tag为asset(pid): Data exceeds UNCOMPRESS_DATA_MAX (2580997 vs 1048576) 可以看到接下产生了一个系统的错误,System.err,会发生java.io.IOException的异常

  目前解决的方法只 有将文件放入到sdcard,但这样除了microsd的读取IO效率和耗电量解决不是很好,同时sd卡移除时可能存在问题,解决的方法如果数据量大的化 通过sqlite是一种解决方法,同时openFileOutput方式读取也是不错的选择,看来android操作系统中最安全控制的严格,但犯了一个 不小的错误。

?

发表评论
用户名: 匿名