1 # Android Asset Packaging Tool 2.0 (AAPT2) release notes
5 - Fixed issue where enum values were interpreted as integers and range checked. (bug 62358540)
6 - Fixed issue where ints and floats with trailing whitespace would not be parsed. (bug 62902869)
7 - Fixed issue where `--custom-package` was not honored when writing Manifest.java. (bug 62826426)
8 - Add `<key-sets>` and its nested tags to the allowed set of XML tags in AndroidManifest.xml.
10 - Fixed issue where Java classes referenced from fragments and menus were not added to
11 the set of Proguard keep rules. (bug 62216174)
12 - Fixed issue where escaped unicode characters would generate malformed UTF-8. (bug 62839202)
13 - Fixed issue where apostrophes or quotes used in XML attribute values were ignored.
14 (bug 62840406, 62840718)
18 - Fixed issue where symlinks would not be followed when compiling PNGs. (bug 62144459)
19 - Fixed issue where overlays that declared `<add-resource>` did not compile. (bug 38355988)
20 - Fixed issue where `%n` in a string resource was interpreted as a format argument. (bug 37132275)
21 - Allow empty resources to compile, giving them a value of `""` or `@null`, depending on the
22 accepted formats. (bug 38425050)
23 - Resources declared via `<item>` with no format attribute were changed to accept all
24 resource types. (bug 62260121)
25 - Allow `<layout>` element under `<activity>` in AndroidManifest.xml. (bug 62189611)
26 - Fix issue where `--no-version-vector` did not apply to `pathInterpolator` and `objectAnimator`.
28 - Fix issue where overlaid `<style>` would not be merged, and would replace the original resource
29 instead. This fix brings behavior in-line with AAPT. (bug 38355988)
33 - Versioning of XML files is more intelligent, using a small set of rules to degrade
34 specific newer attributes to backwards compatible versions of them.
35 Ex: `android:paddingHorizontal` degrades to `android:paddingLeft` and `android:paddingRight`.
38 ### `aapt2 compile ...`
39 - Add `--no-crunch` option to avoid processing PNGs during the compile phase. Note that this
40 shouldn't be used as a performance optimization, as once the PNG is processed, its result is
41 cached for incremental linking. This should only be used if the developer has specially
42 pre-processed the PNG and wants it byte-for-byte identical to the input.
43 NOTE: 9-patches will not be processed correctly with this flag set.
47 - If an app is building with a minSdkVersion < 26 and a --package-id XX where XX > 7F, aapt2
48 will automatically convert any 'id' resource references from the resource ID 0xPPTTEEEE to
50 - This is done to workaround a bug in previous versions of the platform that would validate
51 a resource ID by assuming it is larger than 0. In Java, a resource ID with package ID greater
52 than 0x7F is interpreted as a negative number, causing valid feature split IDs like 0x80010000
54 - '@id/foo' resources are just sentinel values and do not actually need to resolve to anything.
55 Rewriting these resource IDs to use the package ID 7F while maintaining their definitions under
56 the original package ID is safe. Collisions against the base APK are checked to ensure these
57 rewritten IDs to not overlap with the base.
60 ### `aapt2 optimize ...`
61 - aapt2 optimize can now split a binary APK with the same --split parameters as the link
65 ### `aapt2 optimize ...`
66 - aapt2 optimize now understands map (complex) values under the type `id`. It ignores their
67 contents and interprets them as a sentinel `id` type. This was added to support existing
68 apps that build with their `id` types as map values.
69 AAPT and AAPT2 always generate a simple value for the type `ID`, so it is unclear how some
70 these apps are encoded.
74 - Adds the ability to specify assets directories with the -A parameter. Assets work just like
75 assets in the original AAPT. It is not recommended to package assets with aapt2, however,
76 since the resulting APK is post-processed by other tools anyways. Assets do not get processed
77 by AAPT2, just copied, so incremental building gets slower if they are included early on.
81 - Add ability to specify package ID to compile with for regular apps (not shared or static libs).
82 This package ID is limited to the range 0x7f-0xff inclusive. Specified with the --package-id
84 - Fixed issue with <plurals> resources being stripped for locales and other configuration.
85 - Fixed issue with escaping strings in XML resources.
89 - Added sparse resource type encoding, which encodes resource entries that are sparse with
90 a binary search tree representation. Only available when minSdkVersion >= API O or resource
91 qualifier of resource types is >= v26 (or whatever API level O becomes). Enabled with
92 `--enable-sparse-encoding` flag.
93 ### `aapt2 optimize ...`
94 - Adds an optimization pass that supports:
95 - stripping out any density assets that do not match the `--target-densities` list of
97 - resource deduping when the resources are dominated and identical (already happens during
98 `link` phase but this covers apps built with `aapt`).
99 - new sparse resource type encoding with the `--enable-sparse-encoding` flag if possible
100 (minSdkVersion >= O or resource qualifier >= v26).
104 - Adds shared library support. Build a shared library with the `--shared-lib` flag.
105 Build a client of a shared library by simply including it via `-I`.
108 ### `aapt2 compile ...`
109 - Fixes bug where psuedolocalization auto-translated strings marked 'translateable="false"'.
113 - Support legacy `configVarying` resource type.
114 - Support `<bag>` tag and treat as `<style>` regardless of type.
115 - Add `<feature-group>` manifest tag verification.
116 - Add `<meta-data>` tag support to `<instrumentation>`.
120 - Transition XML versioning: Adds a new flag `--no-version-transitions` to disable automatic
121 versioning of Transition XML resources.
125 - Supports `<meta-data>` tags in `<manifest>`.
129 - Support new `font` resource type.
132 ### `aapt2 compile ...`
133 - Added support for inline complex XML resources. See
134 https://developer.android.com/guide/topics/resources/complex-xml-resources.html
136 - Duplicate resource filtering: removes duplicate resources in dominated configurations
137 that are always identical when selected at runtime. This can be disabled with
138 `--no-resource-deduping`.
142 - Configuration Split APK support: supports splitting resources that match a set of
143 configurations to a separate APK which can be loaded alongside the base APK on
144 API 21+ devices. This is done using the flag
145 `--split path/to/split.apk:<config1>[,<config2>,...]`.
146 - SDK version resource filtering: Resources with an SDK version qualifier that is unreachable
147 at runtime due to the minimum SDK level declared by the AndroidManifest.xml are stripped.
150 ### `aapt2 compile ...`
151 - Pseudo-localization: generates pseudolocalized versions of default strings when the
152 `--pseudo-localize` option is specified.
153 - Legacy mode: treats some class of errors as warnings in order to be more compatible
154 with AAPT when `--legacy` is specified.
155 - Compile directory: treats the input file as a directory when `--dir` is
156 specified. This will emit a zip of compiled files, one for each file in the directory.
157 The directory must follow the Android resource directory structure
158 (res/values-[qualifiers]/file.ext).
161 - Automatic attribute versioning: adds version qualifiers to resources that use attributes
162 introduced in a later SDK level. This can be disabled with `--no-auto-version`.
163 - Min SDK resource filtering: removes resources that can't possibly be selected at runtime due
164 to the application's minimum supported SDK level.