MCPcopy Index your code
hub / github.com/APKLab/APKLab / decodeAPK

Function decodeAPK

src/tools/apktool.ts:48–92  ·  view source on GitHub ↗
(
        apkFilePath: string,
        projectDir: string,
        apktoolArgs: string[],
    )

Source from the content-addressed store, hash-verified

46 * @param apktoolArgs array of additional args passed to **Apktool**.
47 */
48 export async function decodeAPK(
49 apkFilePath: string,
50 projectDir: string,
51 apktoolArgs: string[],
52 ): Promise<void> {
53 if (!apkFilePath || !fs.existsSync(apkFilePath)) {
54 vscode.window.showErrorMessage(
55 `APKLab: APK file not found: ${apkFilePath}`,
56 );
57 return;
58 }
59
60 const extensionConfig =
61 vscode.workspace.getConfiguration(extensionConfigName);
62 const apktoolPath = extensionConfig.get("apktoolPath");
63
64 if (!apktoolPath || !fs.existsSync(String(apktoolPath))) {
65 vscode.window.showErrorMessage(
66 "APKLab: Apktool not found. Please check your configuration.",
67 );
68 return;
69 }
70
71 const apkFileName = path.basename(apkFilePath);
72 const report = `Decoding ${apkFileName} into ${projectDir}`;
73 let args = [
74 "-jar",
75 String(apktoolPath),
76 "d",
77 apkFilePath,
78 "-o",
79 projectDir,
80 ];
81 if (apktoolArgs && apktoolArgs.length > 0) {
82 args = args.concat(apktoolArgs);
83 }
84 const shouldExist = path.join(projectDir, APKTOOL_YML_FILENAME);
85 await executeProcess({
86 name: "Decoding",
87 report: report,
88 command: getJavaPath(),
89 args: args,
90 shouldExist: shouldExist,
91 });
92 }
93
94 /**
95 * Rebuild the apk with **Apktool** and signs it with **uber-apk-signer**.

Callers

nothing calls this directly

Calls 2

executeProcessFunction · 0.90
getJavaPathFunction · 0.90

Tested by

no test coverage detected