我想构建一个gradle Exec任务,该任务将在我签名的apk文件上运行android的zipalign,然后验证对齐方式。
最佳答案
变量:
zipalign任务:
task zipAlign(type: Exec) {
executable "${ANDROID_HOME}${ZIPALIGN_PATH}"
args "-f", "-v", "4", "${buildDir}${OUTPUT_APK_PATH}${APK_FILE_TO_ALIGN}", "${buildDir}${OUTPUT_APK_PATH}${APK_FILE_NAME}"
}
zipalign验证任务(请注意,此任务取决于zipalign任务):
task verifyZipAlign(type: Exec, dependsOn: 'zipAlign') {
executable "${ANDROID_HOME}${ZIPALIGN_PATH}"
args "-c", "-v", "4", "${buildDir}${OUTPUT_APK_PATH}${APK_FILE_NAME}"
}