Android aapt 输出格式

标签 android apk aapt

aapt的输出格式是什么?

例如检查这里的输出 http://elinux.org/Android_aapt

config 0 lang=-- cnt=-- orien=0 touch=0 density=def key=0 infl=0 nav=0 w=0 h=0 sz=0 lng=0

resource 0x7f040000 com.android.spare_parts:xml/spare_parts: t=0x03 d=0x00000003 (s=0x0008 r=0x00)

每个字段是什么意思?有没有文档什么的?

最佳答案

这个答案解决了您示例的第二行,aapt dump 对 resources.arsc 中定义的值的表示。

在您的示例中,包 com.android.spare_parts 中 ID 为 0x7f04000 的资源是一个名为 spare_parts 的字符串,其值定义在字符串表中的索引 3 处。

该行的格式如下:

resource <resource ID> <package>:<type>/<name> t=<dataType> d=<data> (s=<size> r=<res0>)

资源 IDwell known您在 R.java 中找到的 ID。

package 只是定义此资源的包,包中的所有资源都相同。

type 资源类型,资源表中其他地方定义的多个字符串之一

name 资源的名称

data为资源值,根据dataType解释(见下文)

size 是值结构(不是值)的大小。似乎总是 0x0008。

res0always 0x00。

dataType 是定义的常量之一 here :

// Contains no data.
TYPE_NULL = 0x00,
// The 'data' holds a ResTable_ref, a reference to another resource
// table entry.
TYPE_REFERENCE = 0x01,
// The 'data' holds an attribute resource identifier.
TYPE_ATTRIBUTE = 0x02,
// The 'data' holds an index into the containing resource table's
// global value string pool.
TYPE_STRING = 0x03,
// The 'data' holds a single-precision floating point number.
TYPE_FLOAT = 0x04,
// The 'data' holds a complex number encoding a dimension value,
// such as "100in".
TYPE_DIMENSION = 0x05,
// The 'data' holds a complex number encoding a fraction of a
// container.
TYPE_FRACTION = 0x06,

// Beginning of integer flavors...
TYPE_FIRST_INT = 0x10,

// The 'data' is a raw integer value of the form n..n.
TYPE_INT_DEC = 0x10,
// The 'data' is a raw integer value of the form 0xn..n.
TYPE_INT_HEX = 0x11,
// The 'data' is either 0 or 1, for input "false" or "true" respectively.
TYPE_INT_BOOLEAN = 0x12,

// Beginning of color integer flavors...
TYPE_FIRST_COLOR_INT = 0x1c,

// The 'data' is a raw integer value of the form #aarrggbb.
TYPE_INT_COLOR_ARGB8 = 0x1c,
// The 'data' is a raw integer value of the form #rrggbb.
TYPE_INT_COLOR_RGB8 = 0x1d,
// The 'data' is a raw integer value of the form #argb.
TYPE_INT_COLOR_ARGB4 = 0x1e,
// The 'data' is a raw integer value of the form #rgb.
TYPE_INT_COLOR_RGB4 = 0x1f,

// ...end of integer flavors.
TYPE_LAST_COLOR_INT = 0x1f,

// ...end of integer flavors.
TYPE_LAST_INT = 0x1f

关于Android aapt 输出格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18336693/

相关文章:

android - 以编程方式复制/system/app/*.apk 到 sdcard

android - 如何通过网络演示我的 Android 应用程序?

Android:无法解析 Galaxy 选项卡中的包

android - Android 项目的 Gradle assembleDebug 失败并出现 aapt 错误

android - 无法安装apk

Android ListView 项目选择问题

java - 更改x轴的日期时间格式?

Android Wear 通过 WiFi TCP/IP 启用 ADB 连接

android - 重新创建后,日夜模式状态栏/控件主题不一致的问题

java - Android 打包问题 "error: Error: No resource found that matches the given name "