1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::deps::*;
use crate::error::*;
use std::path::{Path, PathBuf};
#[derive(Debug)]
pub struct Key {
pub path: PathBuf,
pub password: String,
}
pub fn sign_apk(sdk: &AndroidSdk, apk_path: &Path, key: Key) -> Result<()> {
let mut apksigner = sdk.build_tool(bat!("apksigner"), None)?;
apksigner
.arg("sign")
.arg("--ks")
.arg(&key.path)
.arg("--ks-pass")
.arg(format!("pass:{}", &key.password))
.arg(apk_path);
apksigner.output_err(true)?;
Ok(())
}