Skip to content

Commit

Permalink
Merge pull request #24 from jobobby04/pr
Browse files Browse the repository at this point in the history
Fix zipalign for Android Gradle Plugin 4.1.0
  • Loading branch information
r0adkll authored Nov 12, 2020
2 parents 1d57e61 + 21072f7 commit 5aa7898
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/signing.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function signApkFile(apkFile, signingKeyFile, alias, keyStorePassword, keyPasswo
return __awaiter(this, void 0, void 0, function* () {
core.debug("Zipaligning APK file");
// Find zipalign executable
const buildToolsVersion = process.env.BUILD_TOOLS_VERSION || '29.0.2';
const buildToolsVersion = process.env.BUILD_TOOLS_VERSION || '29.0.3';
const androidHome = process.env.ANDROID_HOME;
const buildTools = path.join(androidHome, `build-tools/${buildToolsVersion}`);
if (!fs.existsSync(buildTools)) {
Expand All @@ -35,7 +35,11 @@ function signApkFile(apkFile, signingKeyFile, alias, keyStorePassword, keyPasswo
// Align the apk file
const alignedApkFile = apkFile.replace('.apk', '-aligned.apk');
yield exec.exec(`"${zipAlign}"`, [
'-c',
'-v', '4',
apkFile
]);
yield exec.exec(`"cp"`, [
apkFile,
alignedApkFile
]);
Expand Down
9 changes: 7 additions & 2 deletions src/signing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function signApkFile(
core.debug("Zipaligning APK file");

// Find zipalign executable
const buildToolsVersion = process.env.BUILD_TOOLS_VERSION || '29.0.2';
const buildToolsVersion = process.env.BUILD_TOOLS_VERSION || '29.0.3';
const androidHome = process.env.ANDROID_HOME;
const buildTools = path.join(androidHome!, `build-tools/${buildToolsVersion}`);
if (!fs.existsSync(buildTools)) {
Expand All @@ -28,7 +28,12 @@ export async function signApkFile(
// Align the apk file
const alignedApkFile = apkFile.replace('.apk', '-aligned.apk');
await exec.exec(`"${zipAlign}"`, [
'-c',
'-v', '4',
apkFile
]);

await exec.exec(`"cp"`, [
apkFile,
alignedApkFile
]);
Expand Down Expand Up @@ -90,4 +95,4 @@ export async function signAabFile(
await exec.exec(`"${jarSignerPath}"`, args);

return aabFile
}
}

0 comments on commit 5aa7898

Please sign in to comment.