Skip to content

Commit

Permalink
Support for user-provided keystore for APK signing
Browse files Browse the repository at this point in the history
  • Loading branch information
Surendrajat committed Oct 14, 2020
1 parent c261229 commit 43e1e77
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ APKLab seamlessly integrates the best open-source tools: <a href="https://github
- Support for Apktool-style projects (`apktool.yml`)
- Support for most Apktool CLI arguments
- Android resource frameworks management (Coming soon!)
- Configure your own app signing certificate (Coming soon!)
- Support for user-provided keystore for APK signing
- Download and configure missing dependencies
- Excellent Smali language support with [**Smalise**](https://marketplace.visualstudio.com/items?itemName=LoyieKing.smalise)
- Supports Linux, Windows, and Mac
Expand Down Expand Up @@ -77,6 +77,9 @@ APKLab seamlessly integrates the best open-source tools: <a href="https://github
## Extension Settings

<details>
<summary>Dependency Paths</summary>

- **`apklab.apktoolPath`**: Full Path of `apktool.jar`. If you want to use a different version of it, change it like:

`"apklab.apktoolPath": "/home/oozer/downloads/apktool_2.4.1.jar"`
Expand All @@ -89,6 +92,22 @@ APKLab seamlessly integrates the best open-source tools: <a href="https://github

`"apklab.jadxDirPath": "/home/oozer/downloads/jadx-1.1.0"`

</details>
<details>
<summary>Keystore configuration</summary>

- **`apklab.keystorePath`**: Put the absolute path of your **Java keystore**(`.jks` or `.keystore`) file here.

`"apklab.keystorePath": "/home/oozer/downloads/debug.keystore"`

- **`apklab.keystorePassword`**: Put the **password** of your keystore here.

- **`apklab.keyAlias`**: Put the **alias** of the used key in the keystore here.

- **`apklab.keyPassword`**: Put the **password** of the used key in the keystore here.

</details>

## Known Issues

- First time when you try <kbd>APKLab: Open an APK</kbd> or <kbd>APKLab: Rebuild the APK</kbd>, the dependencies(ApkTool, etc.) will be downloaded and settings will be updated. However, you may need to restart VS Code once, on download completion, for the settings to be applied.
Expand Down
20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,26 @@
"type": "string",
"default": "",
"markdownDescription": "Put the absolute path of `jadx-x.y.z` dir here if you want to use a non-latest version."
},
"apklab.keystorePath": {
"type": "string",
"default": "",
"markdownDescription": "Put the absolute path of your **Java keystore**(`.jks` or `.keystore`) file here."
},
"apklab.keystorePassword": {
"type": "string",
"default": "",
"markdownDescription": "Put the **password** of your keystore here."
},
"apklab.keyAlias": {
"type": "string",
"default": "",
"markdownDescription": "Put the **alias** of the used key in the keystore here."
},
"apklab.keyPassword": {
"type": "string",
"default": "",
"markdownDescription": "Put the **password** of the used key in the keystore here."
}
}
}
Expand Down
9 changes: 8 additions & 1 deletion src/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,16 @@ export namespace apkSigner {
*/
export function signAPK(projectDir: string, apkFileName: string) {
const apkSignerPath = extensionConfig.get("apkSignerPath");
const keystorePath = extensionConfig.get("keystorePath");
const keystorePassword = extensionConfig.get("keystorePassword");
const keyAlias = extensionConfig.get("keyAlias");
const keyPassword = extensionConfig.get("keyPassword");
const builtApkPath = `${projectDir}/dist/${apkFileName}`;
const report = `Signing ${apkFileName}...`;
const args = ["-jar", String(apkSignerPath), '-a', builtApkPath, '--allowResign', '--overwrite'];
let args = ["-jar", String(apkSignerPath), '-a', builtApkPath, '--allowResign', '--overwrite'];
if (keystorePath && fs.existsSync(String(keystorePath)) && keystorePassword && keyAlias && keyPassword) {
args.push("--ks", String(keystorePath), "--ksPass", String(keystorePassword), "--ksAlias", String(keyAlias), "--ksKeyPass", String(keyPassword));
}
executeProcess({
name: "Signing", report: report, command: "java", args: args, shouldExist: builtApkPath
});
Expand Down

0 comments on commit 43e1e77

Please sign in to comment.