Skip to content

Android: Add proper APK signing & zipalign'ing #2404

@hoffie

Description

@hoffie

APKs currently do not seem to be signed. The androiddeployqt does not contain the relevant parameters:

"${QTDIR}"/bin/androiddeployqt --input $(ls *.json) --output android-build --android-platform android-30 --jdk "${JAVA_HOME}" --gradle

This means that APKs are currently signed with debug keys (which, I assume, are freshly generated in each new run).

02-19 11:55:00.948  1070  1625 W PackageManager: Package com.github.jamulussoftware.jamulus signatures do not match previously installed version; ignoring!
02-19 11:55:00.965   462 30113 E         : Couldn't opendir /data/app/vmdl2123040391.tmp: No such file or directory
02-19 11:55:00.965   462 30113 E installd: Failed to delete /data/app/vmdl2123040391.tmp: No such file or directory
$ /opt/android-sdk/build-tools/30.0.3/apksigner verify --print-certs jamulus_3.8.2beta1_android.apk 
Signer #1 certificate DN: C=US, O=Android, CN=Android Debug
Signer #1 certificate SHA-256 digest: 027398c8681ae8f1eb530afc224e1acbc9a904752af435c37e4e8fcfd47e568f
Signer #1 certificate SHA-1 digest: e080c2b954df6cd94d1305fc025d96a4068f12c8
Signer #1 certificate MD5 digest: af64a6a9340ed57910e387fd8ba1d8b8
$ /opt/android-sdk/build-tools/30.0.3/apksigner verify --print-certs jamulus_3.8.2rc1_android.apk 
Signer #1 certificate DN: C=US, O=Android, CN=Android Debug
Signer #1 certificate SHA-256 digest: 61a02eb837389a9cf17bb7f4b91f3ec72e81e27e19b9a7d3a88fd59142f8497b
Signer #1 certificate SHA-1 digest: b584757c43598e2fb18cac1227ca47600a14816b
Signer #1 certificate MD5 digest: 07eea7058e5a4cd42e14984a50dc64f3

Has this feature been discussed and generally agreed?

No. I believe this is one (maybe even the one) reason for #1760. As signing is a separate, non-trivial task and as I'm not sure if it solves everything, I'm opening this as a dedicated issue.

Describe the solution you'd like

Without having put much effort into research, I assume that simply signing with a proper, permanent self-signed certificate should work: https://doc.qt.io/qtcreator/creator-deploying-android.html#signing-android-packages

Hints that this is the likely root cause:
https://stackoverflow.com/questions/41709102/package-signatures-do-not-match-the-previously-installed-version/41711890#41711890
https://qa.h-mdm.com/5207/cannot-upgrade-the-application-signatures-do-not-match

  • Only start work after autobuild logic refactoring has been completed
  • Securely generate a key
  • Store it in Github secrets
  • Modify autobuild androiddeployqt call to use the key from Github secrets
  • Ensure that zipalign is also run
  • Verify that the Warnining/Error/Update problem goes away

Describe alternatives that have been considered

cc @NickHyHo

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactoringNon-behavioural changes, Code cleanuptoolingChanges to the automated build system

    Type

    No type

    Projects

    Status

    Triage

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions