`

Unable to get buffer of resource asset file

阅读更多

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


解决办法是将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操作系统中最安全控制的严格,但犯了一个不小的错误。

分享到:
评论

相关推荐

    Android WebView 报 Not allowed to load local resource错误的解决办法

    Android WebView 报 Not allowed to load local resource错误的解决办法 博客地址:http://blog.csdn.net/yuzhiqiang_1993/article/details/76228541

    Theory of Asset Pricing--Pennacchi 资产定价理论课后习题答案

    根据提供的文件信息,这里主要涉及的是《资产定价理论》(Theory of Asset Pricing)一书的课后习题答案,该书由著名经济学家George Pennacchi撰写。虽然原文中并未给出具体的习题内容或答案,但从标题和描述来看,...

    AssetsBundleExtractor与AssetStudio

    "AssetsBundleExtractor"和"AssetStudio"就是两个这样的工具,它们在Unity资源管理和调试过程中起到了关键作用。 首先,让我们深入了解**AssetsBundleExtractor**。这是一个用于Unity资源提取的工具,特别适合...

    Theory of Asset Pricing

    在金融领域,《资产定价理论》是一门探讨如何评估金融资产价值的重要学科,其核心在于理解投资者的风险偏好以及资产未来支付的不确定性对价格形成的影响。这一理论不仅深入剖析了资产定价的经济逻辑,还揭示了金融...

    Answer book for Theory of Asset Pricing by George Pennachi

    The answer book for Theory of Asset Pricing by George Pennachi, which is really useful XD

    Digital Asset Management

    instead it is filled with the information you need in order to examine digital asset management and the challenges presented by the management of visual assets, user rights, and branded materials....

    这是VsingerAr的app提取出来的相关文件,包括图片,音频,模型,动作数据_VsingerAr-AssetFile.zip

    这是VsingerAr的app提取出来的相关文件,包括图片,音频,模型,动作数据_VsingerAr-AssetFile

    Android中安装asset下的apk

    ### Android中安装Asset下的APK 在Android开发中,有时候我们可能会遇到需要动态加载或安装应用内部资源(如APK)的需求。本文将详细介绍如何在Android应用中安装存储于`assets`目录下的APK文件。 #### 一、背景...

    Theory of Asset Pricing by George Pennachi

    ### 资产定价理论概览 #### 一、引言 资产定价是金融理论中的核心议题之一,它探讨了如何评估和确定不同资产的价值。《资产定价理论》由著名的经济学家George Pennachi撰写,该书被视为资产定价研究领域内的重要...

    Asset Usage Finder v4.13

    Maybe hard-to-understand asset you have imported? Want a solution that will help seamlessly, without bulky custom UI? We know that feel bro! Introducing Asset Usage Finder v4: Asset that will find...

    stable distributions in BL approach to asset allocation.pdf

    Fabozzi, F.J., Giacometti, R., Bertocchi, M. and Rachev, S.T. (2007) ‘Stable distributions in the Black-Litterman approach to the asset allocation’, Quantitative Finance, Vol. 7, No. 4, pp.423–433.

    AssestStudio.rar

    AssetStudio 是一个强大的独立工具,专门用于解包和浏览 Unity3D 游戏或应用程序的资源文件。这个工具并不是一个Unity插件,而是一个独立的扩展应用,它提供了丰富的功能来帮助开发者、逆向工程师或者游戏爱好者分析...

    【Asset Studio/Unity Studio】AssetStudio v0.13.x

    Asset Studio 和 Unity Studio 是两个与游戏资源解析相关的工具,它们主要服务于Unity 3D 游戏引擎的开发者和逆向工程爱好者。Asset Studio 版本为v0.13.x,由Perfare在2019年06月16日发布。这个工具集能够帮助用户...

    Pocket CIO_The Guide to Successful IT Asset Management-Packt 2018

    Anyone at the executive level deals with a plethora of questions and concerns that would make any normal person's head swim. However, those at the C-level cannot afford that, and so they seek answers ...

    解析Resource格式

    在Android开发中,资源(Resource)是应用程序不可或缺的一部分,它们包括图片、字符串、布局、颜色、动画等。资源文件被编译后,Android系统通过特定的机制进行解析和使用。本篇将深入探讨“解析Resource”这一主题,...

    Asset Hunter 2 2.4.rar_Asset Hunter_unity_unity 插件

    Asset Hunter 2 2.4 是一款专为Unity游戏引擎设计的高效插件,其主要功能在于帮助开发者管理和优化项目中的资源,实现对多余资源的清理,从而有效地释放存储空间,提升项目的运行效率。在Unity开发过程中,资源管理...

    AssetStudio 查看unity资源

    AssetStudio 查看unity资源,支持以下资源解压 Texture2D : convert to png, tga, jpeg, bmp Sprite : crop Texture2D to png, tga, jpeg, bmp AudioClip : mp3, ogg, wav, m4a, fsb. support convert FSB file to ...

    asset pricing

    the bible of asset pricing

    AssetGraph插件unity资源打包

    AssetGraph是Unity引擎中一个非常实用的资源管理与打包工具,尤其在处理AssetBundle时,它的可视化界面使得复杂的资源依赖关系变得清晰易懂。本文将深入探讨AssetGraph的基本概念、功能、工作原理以及如何在Unity...

    Asset Studio Gui

    Asset Studio Gui是一款专为Unity游戏引擎设计的资源解包工具,它允许用户对Unity游戏的资产文件进行查看、提取和编辑。在Unity开发过程中,游戏的资源通常被编译成特殊格式的文件,如.unity3d、.prefab、.anim等,...

Global site tag (gtag.js) - Google Analytics