pub struct Aapt2Link { /* private fields */ }Expand description
§Link
In the link phase, AAPT2 merges all the intermediate files generated from the
compilation phase such as resource tables, binary XML files, and processed
PNG files and packages them into a single APK. Additionally, other auxiliary
files like R.java and ProGuard rules files can be generated during this phase.
However, the generated APK does not contain DEX bytecode and is unsigned.
That is, you can’t deploy this APK to a device. If you’re not using the Android
Gradle Plugin to build your app from the command line, you can use other command
line tools, such as d8 to compile Java bytecode into DEX bytecode and
apksigner to sign your APK.
§Link syntax
The general syntax for using link is as follows:
aapt2 link path-to-input-files [options] -o
outputdirectory/outputfilename.apk --manifest AndroidManifest.xmlIn the following example, AAPT2 merges the two intermediate files -
drawable_Image.flat and values_values.arsc.flat, and the AndroidManifest.xml
file. AAPT2 links the result against android.jar file which holds the resources
defined in the android package:
aapt2 link -o output.apk
-I android_sdk/platforms/android_version/android.jar
compiled/res/values_values.arsc.flat
compiled/res/drawable_Image.flat --manifest /path/to/AndroidManifest.xml -vImplementations§
Source§impl Aapt2Link
impl Aapt2Link
pub fn new(inputs: &[PathBuf], o: &Path, manifest: &Path) -> Self
pub fn i(&mut self, i: PathBuf) -> &mut Self
pub fn a(&mut self, a: PathBuf) -> &mut Self
pub fn r(&mut self, r: PathBuf) -> &mut Self
pub fn package_id(&mut self, package_id: String) -> &mut Self
pub fn allow_reserved_package_id( &mut self, allow_reserved_package_id: bool, ) -> &mut Self
pub fn java_directory(&mut self, java_directory: PathBuf) -> &mut Self
pub fn proguard_options(&mut self, proguard_options: PathBuf) -> &mut Self
pub fn proguard_conditional_keep_rules( &mut self, proguard_conditional_keep_rules: bool, ) -> &mut Self
pub fn no_auto_version(&mut self, no_auto_version: bool) -> &mut Self
pub fn no_version_vectors(&mut self, no_version_vectors: bool) -> &mut Self
pub fn no_version_transitions( &mut self, no_version_transitions: bool, ) -> &mut Self
pub fn no_resource_deduping(&mut self, no_resource_deduping: bool) -> &mut Self
pub fn enable_sparse_encoding( &mut self, enable_sparse_encoding: bool, ) -> &mut Self
pub fn z(&mut self, z: bool) -> &mut Self
pub fn config(&mut self, config: String) -> &mut Self
pub fn preferred_density(&mut self, preferred_density: i32) -> &mut Self
pub fn output_to_dir(&mut self, output_to_dir: bool) -> &mut Self
pub fn min_sdk_version(&mut self, min_sdk_version: i32) -> &mut Self
pub fn target_sdk_version(&mut self, target_sdk_version: i32) -> &mut Self
pub fn version_code(&mut self, version_code: String) -> &mut Self
pub fn compile_sdk_version_name( &mut self, compile_sdk_version_name: String, ) -> &mut Self
pub fn proto_format(&mut self, proto_format: bool) -> &mut Self
pub fn non_final_ids(&mut self, non_final_ids: bool) -> &mut Self
pub fn emit_ids(&mut self, emit_ids: PathBuf) -> &mut Self
pub fn stable_ids(&mut self, stable_ids: PathBuf) -> &mut Self
pub fn custom_package(&mut self, custom_package: PathBuf) -> &mut Self
pub fn extra_packages(&mut self, extra_packages: PathBuf) -> &mut Self
pub fn add_javadoc_annotation( &mut self, add_javadoc_annotation: String, ) -> &mut Self
pub fn output_text_symbols(&mut self, output_text_symbols: PathBuf) -> &mut Self
pub fn auto_add_overlay(&mut self, auto_add_overlay: bool) -> &mut Self
pub fn rename_manifest_package( &mut self, rename_manifest_package: String, ) -> &mut Self
pub fn rename_instrumentation_target_package( &mut self, rename_instrumentation_target_package: String, ) -> &mut Self
pub fn extension(&mut self, extension: String) -> &mut Self
pub fn split(&mut self, split: PathBuf) -> &mut Self
pub fn v(&mut self, v: bool) -> &mut Self
pub fn run(&self)
Trait Implementations§
impl StructuralPartialEq for Aapt2Link
Auto Trait Implementations§
impl Freeze for Aapt2Link
impl RefUnwindSafe for Aapt2Link
impl Send for Aapt2Link
impl Sync for Aapt2Link
impl Unpin for Aapt2Link
impl UnwindSafe for Aapt2Link
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more