So after going back and forth with some on the github azure pipelines task issue thread, I found that by changing my Android gradle plugin from 4.1.0+ (it was at 4.1.1) to 4.0.0 in my project level gradle.settings, the azure pipeline build would complete successfully.
Gradle itself stayed at version 6.5, but the Android gradle plugin was set to 4.0.0 to make it build successfully.
Then, another pointed this thread out on the Google issue tracker: https://issuetracker.google.com/issues/162117652
It appears that the zipalign is no longer necessary as of the latest Android gradle plugin 4.1.0+. I guess Android gradle plugin 4.1.0+ already zipaligns the apk, so any subsequent call to zipalign will show a failure as it’s already zipaligned.
So the ultimate solution here, was to keep the latest version of Android gradle plugin (4.1.1) and change
zipalign: true to
zipalign: false in my Azure pipeline [email protected] task.
You can check to confirm if your APK is actually zipaligned, even with the zipalign set to false in the pipeline, by running the following:
zipalign -c -v 4 /path/to/app-release.apk.
rather than attempt to modify the file, this command will simply verify the zipaling in the apk and show if the verification was successful (apk is zipaligned successfully).
CLICK HERE to find out more related problems solutions.