xref: /aosp_15_r20/frameworks/base/tools/aapt2/readme.md (revision d57664e9bc4670b3ecf6748a746a57c557b6bc9e)
1*d57664e9SAndroid Build Coastguard Worker# Android Asset Packaging Tool 2.0 (AAPT2) release notes
2*d57664e9SAndroid Build Coastguard Worker
3*d57664e9SAndroid Build Coastguard Worker## Version 2.19
4*d57664e9SAndroid Build Coastguard Worker- Added navigation resource type.
5*d57664e9SAndroid Build Coastguard Worker- Fixed issue with resource deduplication. (bug 64397629)
6*d57664e9SAndroid Build Coastguard Worker- Added a daemon mode for issuing commands. This is invoked with `aapt2 daemon`.
7*d57664e9SAndroid Build Coastguard Worker  Command line arguments are separated by newlines, with an empty line signalling the
8*d57664e9SAndroid Build Coastguard Worker  end of a command. Sending `EOF (Ctrl+D)` to the daemon will exit.
9*d57664e9SAndroid Build Coastguard Worker- Fixed an issue where multiple permissions defined in AndroidManifest.xml would generate
10*d57664e9SAndroid Build Coastguard Worker  conflicting definitions for the same Java constant in Manifest.java. Changed the implementation
11*d57664e9SAndroid Build Coastguard Worker  to match that of `aapt`, which will take the last definition as the sole definition.
12*d57664e9SAndroid Build Coastguard Worker  A warning is logged if such a scenario occurs. (bug 64472942)
13*d57664e9SAndroid Build Coastguard Worker- Made improvements to handling of paths on Windows. This should resolve a lot of issues with
14*d57664e9SAndroid Build Coastguard Worker  Unicode paths. (bug 62336414, 63830502)
15*d57664e9SAndroid Build Coastguard Worker
16*d57664e9SAndroid Build Coastguard Worker## Version 2.18
17*d57664e9SAndroid Build Coastguard Worker### `aapt2 ...`
18*d57664e9SAndroid Build Coastguard Worker- Fixed issue where enum values were interpreted as integers and range checked. (bug 62358540)
19*d57664e9SAndroid Build Coastguard Worker- Fixed issue where ints and floats with trailing whitespace would not be parsed. (bug 62902869)
20*d57664e9SAndroid Build Coastguard Worker- Fixed issue where `--custom-package` was not honored when writing Manifest.java. (bug 62826426)
21*d57664e9SAndroid Build Coastguard Worker- Add `<key-sets>` and its nested tags to the allowed set of XML tags in AndroidManifest.xml.
22*d57664e9SAndroid Build Coastguard Worker  (bug 62839863)
23*d57664e9SAndroid Build Coastguard Worker- Fixed issue where Java classes referenced from fragments and menus were not added to
24*d57664e9SAndroid Build Coastguard Worker  the set of Proguard keep rules. (bug 62216174)
25*d57664e9SAndroid Build Coastguard Worker- Fixed issue where escaped unicode characters would generate malformed UTF-8. (bug 62839202)
26*d57664e9SAndroid Build Coastguard Worker- Fixed issue where apostrophes or quotes used in XML attribute values were ignored.
27*d57664e9SAndroid Build Coastguard Worker  (bug 62840406, 62840718)
28*d57664e9SAndroid Build Coastguard Worker
29*d57664e9SAndroid Build Coastguard Worker## Version 2.17
30*d57664e9SAndroid Build Coastguard Worker### `aapt2 ...`
31*d57664e9SAndroid Build Coastguard Worker- Fixed issue where symlinks would not be followed when compiling PNGs. (bug 62144459)
32*d57664e9SAndroid Build Coastguard Worker- Fixed issue where overlays that declared `<add-resource>` did not compile. (bug 38355988)
33*d57664e9SAndroid Build Coastguard Worker- Fixed issue where `%n` in a string resource was interpreted as a format argument. (bug 37132275)
34*d57664e9SAndroid Build Coastguard Worker- Allow empty resources to compile, giving them a value of `""` or `@null`, depending on the
35*d57664e9SAndroid Build Coastguard Worker  accepted formats. (bug 38425050)
36*d57664e9SAndroid Build Coastguard Worker- Resources declared via `<item>` with no format attribute were changed to accept all
37*d57664e9SAndroid Build Coastguard Worker  resource types. (bug 62260121)
38*d57664e9SAndroid Build Coastguard Worker- Allow `<layout>` element under `<activity>` in AndroidManifest.xml. (bug 62189611)
39*d57664e9SAndroid Build Coastguard Worker- Fix issue where `--no-version-vector` did not apply to `pathInterpolator` and `objectAnimator`.
40*d57664e9SAndroid Build Coastguard Worker  (bug 62211148)
41*d57664e9SAndroid Build Coastguard Worker- Fix issue where overlaid `<style>` would not be merged, and would replace the original resource
42*d57664e9SAndroid Build Coastguard Worker  instead. This fix brings behavior in-line with AAPT. (bug 38355988)
43*d57664e9SAndroid Build Coastguard Worker
44*d57664e9SAndroid Build Coastguard Worker## Version 2.16
45*d57664e9SAndroid Build Coastguard Worker### `aapt2 link ...`
46*d57664e9SAndroid Build Coastguard Worker- Versioning of XML files is more intelligent, using a small set of rules to degrade
47*d57664e9SAndroid Build Coastguard Worker  specific newer attributes to backwards compatible versions of them.
48*d57664e9SAndroid Build Coastguard Worker  Ex: `android:paddingHorizontal` degrades to `android:paddingLeft` and `android:paddingRight`.
49*d57664e9SAndroid Build Coastguard Worker
50*d57664e9SAndroid Build Coastguard Worker## Version 2.15
51*d57664e9SAndroid Build Coastguard Worker### `aapt2 compile ...`
52*d57664e9SAndroid Build Coastguard Worker- Add `--no-crunch` option to avoid processing PNGs during the compile phase. Note that this
53*d57664e9SAndroid Build Coastguard Worker  shouldn't be used as a performance optimization, as once the PNG is processed, its result is
54*d57664e9SAndroid Build Coastguard Worker  cached for incremental linking. This should only be used if the developer has specially
55*d57664e9SAndroid Build Coastguard Worker  pre-processed the PNG and wants it byte-for-byte identical to the input.
56*d57664e9SAndroid Build Coastguard Worker  NOTE: 9-patches will not be processed correctly with this flag set.
57*d57664e9SAndroid Build Coastguard Worker
58*d57664e9SAndroid Build Coastguard Worker## Version 2.14
59*d57664e9SAndroid Build Coastguard Worker### `aapt2 link ...`
60*d57664e9SAndroid Build Coastguard Worker- If an app is building with a minSdkVersion < 26 and a --package-id XX where XX > 7F, aapt2
61*d57664e9SAndroid Build Coastguard Worker  will automatically convert any 'id' resource references from the resource ID 0xPPTTEEEE to
62*d57664e9SAndroid Build Coastguard Worker  0x7FPPEEEE.
63*d57664e9SAndroid Build Coastguard Worker- This is done to workaround a bug in previous versions of the platform that would validate
64*d57664e9SAndroid Build Coastguard Worker  a resource ID by assuming it is larger than 0. In Java, a resource ID with package ID greater
65*d57664e9SAndroid Build Coastguard Worker  than 0x7F is interpreted as a negative number, causing valid feature split IDs like 0x80010000
66*d57664e9SAndroid Build Coastguard Worker  to fail the check.
67*d57664e9SAndroid Build Coastguard Worker- '@id/foo' resources are just sentinel values and do not actually need to resolve to anything.
68*d57664e9SAndroid Build Coastguard Worker  Rewriting these resource IDs to use the package ID 7F while maintaining their definitions under
69*d57664e9SAndroid Build Coastguard Worker  the original package ID is safe. Collisions against the base APK are checked to ensure these
70*d57664e9SAndroid Build Coastguard Worker  rewritten IDs to not overlap with the base.
71*d57664e9SAndroid Build Coastguard Worker
72*d57664e9SAndroid Build Coastguard Worker## Version 2.13
73*d57664e9SAndroid Build Coastguard Worker### `aapt2 optimize ...`
74*d57664e9SAndroid Build Coastguard Worker- aapt2 optimize can now split a binary APK with the same --split parameters as the link
75*d57664e9SAndroid Build Coastguard Worker  phase.
76*d57664e9SAndroid Build Coastguard Worker
77*d57664e9SAndroid Build Coastguard Worker## Version 2.12
78*d57664e9SAndroid Build Coastguard Worker### `aapt2 optimize ...`
79*d57664e9SAndroid Build Coastguard Worker- aapt2 optimize now understands map (complex) values under the type `id`. It ignores their
80*d57664e9SAndroid Build Coastguard Worker  contents and interprets them as a sentinel `id` type. This was added to support existing
81*d57664e9SAndroid Build Coastguard Worker  apps that build with their `id` types as map values.
82*d57664e9SAndroid Build Coastguard Worker  AAPT and AAPT2 always generate a simple value for the type `ID`, so it is unclear how some
83*d57664e9SAndroid Build Coastguard Worker  these apps are encoded.
84*d57664e9SAndroid Build Coastguard Worker
85*d57664e9SAndroid Build Coastguard Worker## Version 2.11
86*d57664e9SAndroid Build Coastguard Worker### `aapt2 link ...`
87*d57664e9SAndroid Build Coastguard Worker- Adds the ability to specify assets directories with the -A parameter. Assets work just like
88*d57664e9SAndroid Build Coastguard Worker  assets in the original AAPT. It is not recommended to package assets with aapt2, however,
89*d57664e9SAndroid Build Coastguard Worker  since the resulting APK is post-processed by other tools anyways. Assets do not get processed
90*d57664e9SAndroid Build Coastguard Worker  by AAPT2, just copied, so incremental building gets slower if they are included early on.
91*d57664e9SAndroid Build Coastguard Worker
92*d57664e9SAndroid Build Coastguard Worker## Version 2.10
93*d57664e9SAndroid Build Coastguard Worker### `aapt2 link ...`
94*d57664e9SAndroid Build Coastguard Worker- Add ability to specify package ID to compile with for regular apps (not shared or static libs).
95*d57664e9SAndroid Build Coastguard Worker  This package ID is limited to the range 0x7f-0xff inclusive. Specified with the --package-id
96*d57664e9SAndroid Build Coastguard Worker  flag.
97*d57664e9SAndroid Build Coastguard Worker- Fixed issue with <plurals> resources being stripped for locales and other configuration.
98*d57664e9SAndroid Build Coastguard Worker- Fixed issue with escaping strings in XML resources.
99*d57664e9SAndroid Build Coastguard Worker
100*d57664e9SAndroid Build Coastguard Worker## Version 2.9
101*d57664e9SAndroid Build Coastguard Worker### `aapt2 link ...`
102*d57664e9SAndroid Build Coastguard Worker- Added sparse resource type encoding, which encodes resource entries that are sparse with
103*d57664e9SAndroid Build Coastguard Worker  a binary search tree representation. Only available when minSdkVersion >= API O or resource
104*d57664e9SAndroid Build Coastguard Worker  qualifier of resource types is >= v26 (or whatever API level O becomes). Enabled with
105*d57664e9SAndroid Build Coastguard Worker  `--enable-sparse-encoding` flag.
106*d57664e9SAndroid Build Coastguard Worker### `aapt2 optimize ...`
107*d57664e9SAndroid Build Coastguard Worker- Adds an optimization pass that supports:
108*d57664e9SAndroid Build Coastguard Worker    - stripping out any density assets that do not match the `--target-densities` list of
109*d57664e9SAndroid Build Coastguard Worker      densities.
110*d57664e9SAndroid Build Coastguard Worker    - resource deduping when the resources are dominated and identical (already happens during
111*d57664e9SAndroid Build Coastguard Worker      `link` phase but this covers apps built with `aapt`).
112*d57664e9SAndroid Build Coastguard Worker    - new sparse resource type encoding with the `--enable-sparse-encoding` flag if possible
113*d57664e9SAndroid Build Coastguard Worker      (minSdkVersion >= O or resource qualifier >= v26).
114*d57664e9SAndroid Build Coastguard Worker
115*d57664e9SAndroid Build Coastguard Worker## Version 2.8
116*d57664e9SAndroid Build Coastguard Worker### `aapt2 link ...`
117*d57664e9SAndroid Build Coastguard Worker- Adds shared library support. Build a shared library with the `--shared-lib` flag.
118*d57664e9SAndroid Build Coastguard Worker  Build a client of a shared library by simply including it via `-I`.
119*d57664e9SAndroid Build Coastguard Worker
120*d57664e9SAndroid Build Coastguard Worker## Version 2.7
121*d57664e9SAndroid Build Coastguard Worker### `aapt2 compile ...`
122*d57664e9SAndroid Build Coastguard Worker- Fixes bug where psuedolocalization auto-translated strings marked 'translateable="false"'.
123*d57664e9SAndroid Build Coastguard Worker
124*d57664e9SAndroid Build Coastguard Worker## Version 2.6
125*d57664e9SAndroid Build Coastguard Worker### `aapt2`
126*d57664e9SAndroid Build Coastguard Worker- Support legacy `configVarying` resource type.
127*d57664e9SAndroid Build Coastguard Worker- Support `<bag>` tag and treat as `<style>` regardless of type.
128*d57664e9SAndroid Build Coastguard Worker- Add `<feature-group>` manifest tag verification.
129*d57664e9SAndroid Build Coastguard Worker- Add `<meta-data>` tag support to `<instrumentation>`.
130*d57664e9SAndroid Build Coastguard Worker
131*d57664e9SAndroid Build Coastguard Worker## Version 2.5
132*d57664e9SAndroid Build Coastguard Worker### `aapt2 link ...`
133*d57664e9SAndroid Build Coastguard Worker- Transition XML versioning: Adds a new flag `--no-version-transitions` to disable automatic
134*d57664e9SAndroid Build Coastguard Worker  versioning of Transition XML resources.
135*d57664e9SAndroid Build Coastguard Worker
136*d57664e9SAndroid Build Coastguard Worker## Version 2.4
137*d57664e9SAndroid Build Coastguard Worker### `aapt2 link ...`
138*d57664e9SAndroid Build Coastguard Worker- Supports `<meta-data>` tags in `<manifest>`.
139*d57664e9SAndroid Build Coastguard Worker
140*d57664e9SAndroid Build Coastguard Worker## Version 2.3
141*d57664e9SAndroid Build Coastguard Worker### `aapt2`
142*d57664e9SAndroid Build Coastguard Worker- Support new `font` resource type.
143*d57664e9SAndroid Build Coastguard Worker
144*d57664e9SAndroid Build Coastguard Worker## Version 2.2
145*d57664e9SAndroid Build Coastguard Worker### `aapt2 compile ...`
146*d57664e9SAndroid Build Coastguard Worker- Added support for inline complex XML resources. See
147*d57664e9SAndroid Build Coastguard Worker  https://developer.android.com/guide/topics/resources/complex-xml-resources.html
148*d57664e9SAndroid Build Coastguard Worker### `aapt link ...`
149*d57664e9SAndroid Build Coastguard Worker- Duplicate resource filtering: removes duplicate resources in dominated configurations
150*d57664e9SAndroid Build Coastguard Worker  that are always identical when selected at runtime. This can be disabled with
151*d57664e9SAndroid Build Coastguard Worker  `--no-resource-deduping`.
152*d57664e9SAndroid Build Coastguard Worker
153*d57664e9SAndroid Build Coastguard Worker## Version 2.1
154*d57664e9SAndroid Build Coastguard Worker### `aapt2 link ...`
155*d57664e9SAndroid Build Coastguard Worker- Configuration Split APK support: supports splitting resources that match a set of
156*d57664e9SAndroid Build Coastguard Worker  configurations to a separate APK which can be loaded alongside the base APK on
157*d57664e9SAndroid Build Coastguard Worker  API 21+ devices. This is done using the flag
158*d57664e9SAndroid Build Coastguard Worker  `--split path/to/split.apk:<config1>[,<config2>,...]`.
159*d57664e9SAndroid Build Coastguard Worker- SDK version resource filtering: Resources with an SDK version qualifier that is unreachable
160*d57664e9SAndroid Build Coastguard Worker  at runtime due to the minimum SDK level declared by the AndroidManifest.xml are stripped.
161*d57664e9SAndroid Build Coastguard Worker
162*d57664e9SAndroid Build Coastguard Worker## Version 2.0
163*d57664e9SAndroid Build Coastguard Worker### `aapt2 compile ...`
164*d57664e9SAndroid Build Coastguard Worker- Pseudo-localization: generates pseudolocalized versions of default strings when the
165*d57664e9SAndroid Build Coastguard Worker  `--pseudo-localize` option is specified.
166*d57664e9SAndroid Build Coastguard Worker- Legacy mode: treats some class of errors as warnings in order to be more compatible
167*d57664e9SAndroid Build Coastguard Worker  with AAPT when `--legacy` is specified.
168*d57664e9SAndroid Build Coastguard Worker- Compile directory: treats the input file as a directory when `--dir` is
169*d57664e9SAndroid Build Coastguard Worker  specified. This will emit a zip of compiled files, one for each file in the directory.
170*d57664e9SAndroid Build Coastguard Worker  The directory must follow the Android resource directory structure
171*d57664e9SAndroid Build Coastguard Worker  (res/values-[qualifiers]/file.ext).
172*d57664e9SAndroid Build Coastguard Worker
173*d57664e9SAndroid Build Coastguard Worker### `aapt2 link ...`
174*d57664e9SAndroid Build Coastguard Worker- Automatic attribute versioning: adds version qualifiers to resources that use attributes
175*d57664e9SAndroid Build Coastguard Worker  introduced in a later SDK level. This can be disabled with `--no-auto-version`.
176*d57664e9SAndroid Build Coastguard Worker- Min SDK resource filtering: removes resources that can't possibly be selected at runtime due
177*d57664e9SAndroid Build Coastguard Worker  to the application's minimum supported SDK level.
178