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 · 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.