Aapt2Link

Struct Aapt2Link 

Source
pub struct Aapt2Link { /* private fields */ }
Expand description

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.

The general syntax for using link is as follows:

aapt2 link path-to-input-files [options] -o
outputdirectory/outputfilename.apk --manifest AndroidManifest.xml

In 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 -v

Implementations§

Source

pub fn new(inputs: &[PathBuf], o: &Path, manifest: &Path) -> Self

Source

pub fn i(&mut self, i: PathBuf) -> &mut Self

Source

pub fn a(&mut self, a: PathBuf) -> &mut Self

Source

pub fn r(&mut self, r: PathBuf) -> &mut Self

Source

pub fn package_id(&mut self, package_id: String) -> &mut Self

Source

pub fn allow_reserved_package_id( &mut self, allow_reserved_package_id: bool, ) -> &mut Self

Source

pub fn java_directory(&mut self, java_directory: PathBuf) -> &mut Self

Source

pub fn proguard_options(&mut self, proguard_options: PathBuf) -> &mut Self

Source

pub fn proguard_conditional_keep_rules( &mut self, proguard_conditional_keep_rules: bool, ) -> &mut Self

Source

pub fn no_auto_version(&mut self, no_auto_version: bool) -> &mut Self

Source

pub fn no_version_vectors(&mut self, no_version_vectors: bool) -> &mut Self

Source

pub fn no_version_transitions( &mut self, no_version_transitions: bool, ) -> &mut Self

Source

pub fn no_resource_deduping(&mut self, no_resource_deduping: bool) -> &mut Self

Source

pub fn enable_sparse_encoding( &mut self, enable_sparse_encoding: bool, ) -> &mut Self

Source

pub fn z(&mut self, z: bool) -> &mut Self

Source

pub fn config(&mut self, config: String) -> &mut Self

Source

pub fn preferred_density(&mut self, preferred_density: i32) -> &mut Self

Source

pub fn output_to_dir(&mut self, output_to_dir: bool) -> &mut Self

Source

pub fn min_sdk_version(&mut self, min_sdk_version: i32) -> &mut Self

Source

pub fn target_sdk_version(&mut self, target_sdk_version: i32) -> &mut Self

Source

pub fn version_code(&mut self, version_code: String) -> &mut Self

Source

pub fn compile_sdk_version_name( &mut self, compile_sdk_version_name: String, ) -> &mut Self

Source

pub fn proto_format(&mut self, proto_format: bool) -> &mut Self

Source

pub fn non_final_ids(&mut self, non_final_ids: bool) -> &mut Self

Source

pub fn emit_ids(&mut self, emit_ids: PathBuf) -> &mut Self

Source

pub fn stable_ids(&mut self, stable_ids: PathBuf) -> &mut Self

Source

pub fn custom_package(&mut self, custom_package: PathBuf) -> &mut Self

Source

pub fn extra_packages(&mut self, extra_packages: PathBuf) -> &mut Self

Source

pub fn add_javadoc_annotation( &mut self, add_javadoc_annotation: String, ) -> &mut Self

Source

pub fn output_text_symbols(&mut self, output_text_symbols: PathBuf) -> &mut Self

Source

pub fn auto_add_overlay(&mut self, auto_add_overlay: bool) -> &mut Self

Source

pub fn rename_manifest_package( &mut self, rename_manifest_package: String, ) -> &mut Self

Source

pub fn rename_instrumentation_target_package( &mut self, rename_instrumentation_target_package: String, ) -> &mut Self

Source

pub fn extension(&mut self, extension: String) -> &mut Self

Source

pub fn split(&mut self, split: PathBuf) -> &mut Self

Source

pub fn v(&mut self, v: bool) -> &mut Self

Source

pub fn run(&self)

Trait Implementations§

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

fn eq(&self, other: &Aapt2Link) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.