Skip to main content

Aapt2Optimize

Struct Aapt2Optimize 

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

Preforms resource optimizations on an APK

Implementationsยง

Sourceยง

impl Aapt2Optimize

Source

pub fn new(output_apk: &Path, output_dir: &Path) -> Self

Initialize aapt2 optimize then specifies path to the aapt2 link output APK and Path to the output directory (for splits)

Source

pub fn config_xml_file(&mut self, config_xml_file: &Path) -> &mut Self

Specifies path to XML configuration file

Source

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

Print the multi APK artifacts and exit

Source

pub fn target_densities(&mut self, target_densities: &str) -> &mut Self

Comma separated list of the screen densities that the APK will be optimized for. All the resources that would be unused on devices of the given densities will be removed from the APK

Source

pub fn resources_config_path( &mut self, resources_config_path: &Path, ) -> &mut Self

Path to the resources.cfg file containing the list of resources and directives to each resource. Format: type/resource_name#[directive][,directive]

Source

pub fn configs_to_include(&mut self, configs_to_include: &str) -> &mut Self

Comma separated list of configurations to include. The default is all configurations

Source

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

Split resources matching a set of configs out to a Split APK. Syntax:

`path/to/output.apk;<config>[,<config>[...]].`

On Windows, use a semicolon ; separator instead

Source

pub fn keep_artifacts(&mut self, keep_artifacts: &str) -> &mut Self

Comma separated list of artifacts to keep. If none are specified, all artifacts will be kept

Source

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

Enables encoding sparse entries using a binary search tree. This decreases APK size at the cost of resource retrieval performance

Source

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

Collapses resource names to a single value in the key string pool. Resources can be exempted using the no_collapse directive in a file specified by --resources-config-path

Source

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

Shortens the paths of resources inside the APK

Source

pub fn resource_path_shortening_map( &mut self, resource_path_shortening_map: &Path, ) -> &mut Self

Path to output the map of old resource paths to shortened paths

Source

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

Enables verbose logging

Source

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

Displays this help menu

Source

pub fn run(self) -> Result<()>

Executes aapt2 optimize with arguments

Trait Implementationsยง

Sourceยง

impl Clone for Aapt2Optimize

Sourceยง

fn clone(&self) -> Aapt2Optimize

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) ยท Sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Sourceยง

impl Default for Aapt2Optimize

Sourceยง

fn default() -> Aapt2Optimize

Returns the โ€œdefault valueโ€ for a type. Read more

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> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.