jamulussoftware / jamulussoftware/jamulus

Android: Add proper APK signing & zipalign'ing

Open
#2,404 10 comments 0 reactions 0 assignees View on GitHub
refactoring tooling
Dominant language
C
Stars
1.1k
Forks
248
Avg merge
2d 3h
Merged PRs (30d)
9

Description

APKs currently do not seem to be signed. The `androiddeployqt` does not contain the relevant parameters:
https://github.com/jamulussoftware/jamulus/blob/5f8ce856114f3ff34ba7bbd43bfaac0ff9579b52/autobuild/android/autobuild_apk_2_build.sh#L33

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

- [x] 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

Contributor guide

Open the contributing guide

Research direction

Start with autobuild/android/autobuild_apk_2_build.sh at the referenced androiddeployqt call, after the autobuild logic refactoring is complete. Determine how a permanent signing key can be securely provided through GitHub secrets, then ensure signing and zipalign are applied and verify the APK with apksigner and the install/update behavior described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
android
Domain
build-system, ci-cd, mobile-dev, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.