saker.android Documentation TaskDoc JavaDoc Packages
Links compiled Android resources using the aapt2 tool. The task can be used to link previously compiled resources together for creating a base APK. The output APK will contain the input resources and AndroidManifest.xml in compiled format. The link operation produces the R Java class which contains the identifiers for each resource in your application. You can use these identifiers to reference from your code. Make sure to add the JavaSourceDirectories to your Java compilation task as input. You can add AAR dependencies to the compilation task with the Overlay parameter. In that case make sure to set the AutoAddOverlay to true.
Summary
Parameters
AllowReservedPackageIdAllows the use of a reserved package ID.Reserved package IDs are IDs that are normally assigned to shared libraries and are in the range from 0x02 to 0x7e inclusive.
AutoAddOverlayAllows the addition of new resources in overlays without using the <add-resource> tag.
CompileSDKVersionCodeSpecifies the version code to inject into the AndroidManifest.xml if none is present.
CompileSDKVersionNameSpecifies the version name to inject into the AndroidManifest.xml if none is present.
ConfigurationsList of configurations.
CreateIDMappingsCause the build task to emit a file with a list of names of resource types and their ID mappings.
CustomPackageSpecifies custom Java package under which to generate R.java.
DebugModeInserts android:debuggable="true" in to the application node of the manifest, making the application debuggable even on production devices.
EnableSparseEncodingEnables encoding of sparse entries using a binary search tree.
ExcludeConfigurationsExcludes values of resources whose configs contain the specified qualifiers.
ExtraPackagesSpecifies one or more Java package names under which the same R.java source file should be generated.
GenerateMainDexProguardRulesFlag to specify if ProGuard files for the main dex file should be generated.
GenerateProguardRulesFlag to specify if ProGuard files should be generated.
IdentifierSpecifies an identifier for the linking operation.
Input
Required parameter.
The inputs for the linking operation.
JavadocAnnotationsAdds a JavaDoc annotation to all generated Java classes.
KeepRawValuesPreserve raw attribute values in xml files.
Manifest
Required parameter.
Specifies the AndroidManifest.xml file for the linking operation.
MinSDKVersionSets the default minimum SDK version to use for AndroidManifest.xml.
NoAutoVersionDisables automatic style and layout SDK versioning.
NoCompressDo not compress any resources.
NoCompressRegexDo not compress extensions matching the regular expression.
NoResourceDedupingDisables automatic de-duplication of resources with identical values across compatible configurations.
NoResourceRemovalDisables automatic removal of resources without defaults.
NoStaticLibPackagesMerge all library resources under the app's package.
NoVersionTransitionsDisables automatic versioning of transition resources.
NoVersionVectorsDisables automatic versioning of vector drawables.
NoXmlNamespacesRemoves XML namespace prefix and URI information from AndroidManifest.xml and XML binaries in res/*.
NonCompressedExtensionsSpecifies the extensions of files that you do not want to compress.
NonFinalIdsGenerates R.java with non-final resource IDs.
OutputFormatSpecifies the output format of the linking.
OverlayAdds compiled resources for the linking operation using overlay semantics.
PackageIdSpecifies the package ID to use for your app.
PreferredDensitySpecify a preferred density, to cause AAPT2 to select and store the closest matching density in the resource table and remove all others.
PrivateSymbolsPackage name to use when generating R.java for private symbols.
ProductNamesList of product names to keep.
ProguardConditionalKeepRulesGenerate conditional Proguard keep rules.
ProguardMinimalKeepRulesGenerate a minimal set of Proguard keep rules.
RenameInstrumentationTargetPackageChanges the name of the target package for instrumentation.
RenameManifestPackageRenames the package in AndroidManifest.xml.
ReplaceVersionIf --version-code and/or --version-name are specified, these values will replace any value already in the manifest.
RequireSuggestedLocalizationRequires localization of strings marked 'suggested'.
SDKsSpecifies the SDKs (Software Development Kits) used by the task.
SplitsSplits resources based on a set of configurations to generate a different version of the APK.
StableIDsFilePath to a file generated with --emit-ids containing the list of names of resource types and their assigned IDs.
StrictVisibilityDo not allow overlays with different visibility levels.
TargetSDKVersionSets the default target SDK version to use for AndroidManifest.xml.
VerboseEnable verbose logging.
VersionCodeSpecifies the version code to inject into the AndroidManifest.xml if none is present.
VersionCodeMajorSpecifies the version code major to inject into the AndroidManifest.xml if none is present.
VersionNameSpecifies the version name to inject into the AndroidManifest.xml if none is present.
WarnManifestValidationTreat manifest validation errors as warnings.
Parameters
Allows the use of a reserved package ID.Reserved package IDs are IDs that are normally assigned to shared libraries and are in the range from 0x02 to 0x7e inclusive. By using --allow-reserved-package-id, you can assign IDs that fall in the range of reserved package IDs. This should only be used for packages with a min-sdk version of 26 or lower. This parameter corresponds to the --allow-reserved-package-id option of aapt2.
Allows the addition of new resources in overlays without using the <add-resource> tag. This parameter corresponds to the --auto-add-overlay option of aapt2.
Specifies the version code to inject into the AndroidManifest.xml if none is present. This parameter corresponds to the --compile-sdk-version-code option of aapt2.
Specifies the version name to inject into the AndroidManifest.xml if none is present. This parameter corresponds to the --compile-sdk-version-name option of aapt2.
Collection of String
List of configurations. Each element will be joined with a comma separator and passed as the -c aapt2 parameter. For example, if you have dependencies on the support library (which contains translations for multiple languages), you can filter resources just for the given language configuration, like English or Spanish. You must define the language configuration by a two-letter ISO 639-1 language code, optionally followed by a two letter ISO 3166-1-alpha-2 region code preceded by lowercase 'r' (for example, en-rUS).
Cause the build task to emit a file with a list of names of resource types and their ID mappings. Causes the task to use the --emit-ids option of aapt2.
Specifies custom Java package under which to generate R.java. This parameter corresponds to the --custom-package option of aapt2.
Inserts android:debuggable="true" in to the application node of the manifest, making the application debuggable even on production devices. This parameter corresponds to the --debug-mode option of aapt2.
Enables encoding of sparse entries using a binary search tree. This is useful for optimization of APK size, but at the cost of resource retrieval performance. This parameter corresponds to the --enable-sparse-encoding option of aapt2.
Excludes values of resources whose configs contain the specified qualifiers. Each element in this parameter corresponds to an --exclude-configs option of aapt2.
Collection of String
Specifies one or more Java package names under which the same R.java source file should be generated. Each element in this parameter corresponds to an --extra-packages option of aapt2.
Flag to specify if ProGuard files for the main dex file should be generated. This parameter corresponds to the --proguard-main-dex option of aapt2.
Flag to specify if ProGuard files should be generated. This parameter corresponds to the --proguard option of aapt2.
Specifies an identifier for the linking operation. The identifier will be used to uniquely identify this operation, and to generate the output directory name.
Required parameter.
The inputs for the linking operation. The parameter accepts one or more elemets which may be outputs from the saker.android.aapt2.compile() task, as well as direct file paths to compiled resource files. Generally, you will be passing the output of aapt2 compilation for this parameter. Any implicit AAR compilation results that are part of the input will be automatically added.
Adds a JavaDoc annotation to all generated Java classes. Each element in this parameter corresponds to an --add-javadoc-annotation option of aapt2.
Preserve raw attribute values in xml files. This parameter corresponds to the --keep-raw-values option of aapt2.
Required parameter.
Specifies the AndroidManifest.xml file for the linking operation. This is a required parameter because the manifest file encloses essential information about your app like package name and application ID. This parameter corresponds to the --manifest option of aapt2.
Sets the default minimum SDK version to use for AndroidManifest.xml. This parameter corresponds to the --min-sdk-version option of aapt2.
Disables automatic style and layout SDK versioning. This parameter corresponds to the --no-auto-version option of aapt2.
Do not compress any resources. This parameter corresponds to the --no-compress option of aapt2.
Do not compress extensions matching the regular expression. Remember to use the '$' symbol for end of line. Uses a case-sensitive ECMAScriptregular expression grammar. This parameter corresponds to the --no-compress-regex option of aapt2.
Disables automatic de-duplication of resources with identical values across compatible configurations. This parameter corresponds to the --no-resource-deduping option of aapt2.
Disables automatic removal of resources without defaults. Use this only when building runtime resource overlay packages. This parameter corresponds to the --no-resource-removal option of aapt2.
Merge all library resources under the app's package. This parameter corresponds to the --no-static-lib-packages option of aapt2.
Disables automatic versioning of transition resources. Use this only when building your APK with Transition Support library. This parameter corresponds to the --no-version-transitions option of aapt2.
Disables automatic versioning of vector drawables. Use this only when building your APK with the Vector Drawable Library. This parameter corresponds to the --no-version-vectors option of aapt2.
Removes XML namespace prefix and URI information from AndroidManifest.xml and XML binaries in res/*. This parameter corresponds to the --no-xml-namespaces option of aapt2.
Specifies the extensions of files that you do not want to compress. Each element in this parameter corresponds to an -0 option of aapt2.
Generates R.java with non-final resource IDs. This parameter corresponds to the --non-final-ids option of aapt2.
Specifies the output format of the linking. Corresponds to the --shared-lib, --static-lib, --proto-format flags of aapt2.
Adds compiled resources for the linking operation using overlay semantics. When you a provide a resource file that overlays (extends or modifies) an existing file, the last conflicting resource given is used.The parameter accepts one or more elemets which may be outputs from the saker.android.aapt2.compile() task, as well as direct file paths to compiled resource files. Generally, you will be passing the aapt2 compilation output of the library dependencies for this parameter. Any implicit AAR compilation results that are part of the input will be automatically added. When using this parameter, you probably want to set the AutoAddOverlay parameter to true. This parameter corresponds to the -R option of aapt2.
Specifies the package ID to use for your app. The package ID that you specify must be greater than or equal to 0x7f unless used in combination with --allow-reserved-package-id. This parameter corresponds to the --package-id option of aapt2.
Specify a preferred density, to cause AAPT2 to select and store the closest matching density in the resource table and remove all others. This parameter corresponds to the --preferred-density option of aapt2.
Package name to use when generating R.java for private symbols. If not specified, public and private symbols will use the application's package name. This parameter corresponds to the --private-symbols option of aapt2.
Collection of String
List of product names to keep. Each element will be joined with a comma separator and passed as the -product aapt2 parameter.
Generate conditional Proguard keep rules. This parameter corresponds to the --proguard-conditional-keep-rules option of aapt2.
Generate a minimal set of Proguard keep rules. This parameter corresponds to the --proguard-minimal-keep-rules option of aapt2.
Changes the name of the target package for instrumentation. It should be used in conjunction with --rename-manifest-package. This parameter corresponds to the --rename-instrumentation-target-package option of aapt2.
Renames the package in AndroidManifest.xml. This parameter corresponds to the --rename-manifest-package option of aapt2.
If --version-code and/or --version-name are specified, these values will replace any value already in the manifest. By default, nothing is changed if the manifest already defines these attributes. This parameter corresponds to the --replace-version option of aapt2.
Requires localization of strings marked 'suggested'. This parameter corresponds to the -z option of aapt2.
Specifies the SDKs (Software Development Kits) used by the task. SDKs represent development kits that are available in the build environment and to the task. They are used to find the necessary tools to perform the necessary operations. You should specify the AndroidBuildTools and AndroidPlatform SDKs so the build tasks can find the relevant tools to perform their operations. If you don't specify these SDKs, then the build tasks will attempt to locate them automatically. If they fail to do so, an exception is thrown. You can use the saker.android.sdk.buildtools() and saker.android.sdk.platform() tasks to retrieve SDKs with specific versions. The SDK names are compared in a case-insensitive way.
Splits resources based on a set of configurations to generate a different version of the APK. The parameter takes a map as its input where each key is an APK name and the value is a list of configurations that the associated APK should contain.Each element in this parameter corresponds to a --split option of aapt2.
Path to a file generated with --emit-ids containing the list of names of resource types and their assigned IDs. This option allows assigned IDs to remain stable even when you delete or add new resources while linking. This parameter corresponds to the --stable-ids option of aapt2.
Do not allow overlays with different visibility levels. This parameter corresponds to the --strict-visibility option of aapt2.
Sets the default target SDK version to use for AndroidManifest.xml. This parameter corresponds to the --target-sdk-version option of aapt2.
Enable verbose logging. Corresponds to the -v flag of aapt2.
Specifies the version code to inject into the AndroidManifest.xml if none is present. This parameter corresponds to the --version-code option of aapt2.
Specifies the version code major to inject into the AndroidManifest.xml if none is present. This parameter corresponds to the --version-code-major option of aapt2.
Specifies the version name to inject into the AndroidManifest.xml if none is present. This parameter corresponds to the --version-name option of aapt2.
Treat manifest validation errors as warnings. This parameter corresponds to the --warn-manifest-validation option of aapt2.