-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android: Set proper versionCode and versionName #2398
Android: Set proper versionCode and versionName #2398
Conversation
@hoffie First, a Government Health Warning: My coding days are long (30+ years!) gone, and my training/experience on GitHub is zilch, but here goes... Managed to find an APK "3.8.2rc1dev-c50f092 (1)" which I installed ok, but I have a feeling that it made itself at home as a brand new package... so I then found APK "3.8.2rc1dev-26b235b0 (4749)" hot off the press, attempted to install, got "This package is already installed ... {2x package details} ... Do you want to install the update", so I did attempt install, but got "App not installed as package conflicts with an existing package." It's now a bit late here (UK) so I won't try to untangle myself until tomorrow... Since I'm junior at GitHub, please could you point me directly to the APK you'd like me to try, I'll then clear down, install the official Jamulus build, put some settings in (so I know if they're maintained during update!), then try to install your new APK on top... Or another process if you wish! |
@hoffie Doh! I used wrong device last night (2 similar phones, tired person, any excuse...). This morning I used the correct device, attempted install of 3.8.2rc1dev-26b235b0 (4749) over 3.8.0, but it still ended with "App not installed". I don't know if I used the correct Release Candidate, but my erroneous work last night might suggest that there's still a problem anyway? |
The assets from the latest run are here (as far as I can tell...): It looks like that's the one you used. |
@pljones Thanks yes, that's the one, so I think it's not quite fixed yet... |
@NickHyHo Thanks for testing. So this PR doesn't seem to be enough to fix the issue. I still believe it's right and improves things (we were always version 1 before that PR), but there's no hurry in getting it merged. I'm leaving it open for merge after 3.8.2. |
4920476
to
967b57b
Compare
967b57b
to
e61419b
Compare
Unfortunately I don’t have access to the Android device anymore. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far, but I'd like to try an installation, and maybe even a build myself.
@@ -168,6 +169,7 @@ jobs: | |||
uses: actions/checkout@v2 | |||
with: | |||
submodules: true | |||
fetch-depth: ${{ matrix.config.checkout_fetch_depth || '1' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the checkout_fetch_depth: '0'
further up evaluate here as false or true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't found explicit documentation, but the CI confirms that it does what it should: Android uses a full checkout while the other targets (e.g. Linux) only fetch the most recent commit:
Therefore, I assume that '0'
as a non-empty string evaluates to true
(probably like Python).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Therefore, I assume that
'0'
as a non-empty string evaluates totrue
(probably like Python).
And unlike Perl and PHP!
ANDROID_ABIS = armeabi-v7a arm64-v8a x86 x86_64 | ||
ANDROID_VERSION_NAME = $$VERSION | ||
ANDROID_VERSION_CODE = $$system(git log --oneline | wc -l) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't see in the build log where these get used. If they are used silently, then perhaps they could be echoed too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, they're qmake-internal variables. I've added a message()
call to output them now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tried installing jamulus_3.8.2dev-5f108fd_android.apk over 3.8.0 ... result is as before, i.e. version number is reported as being different (see screenshot attached), but install ends with message "App not installed". I suspect this is "as expected" at the moment! BTW, if you want me to check any functionality on any new build let me know - I have several Android devices at my disposal, and can force a new build to install by uninstalling any old one, of course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, first time I've posted an image - didn't realise it'd come out that big on screen!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I've edited your comment to use <img src="...existing url.." width="2002>
to reduce the size a bit.
result is as before, i.e. version number is reported as being different (see screenshot attached)
but install ends with message "App not installed". I suspect this is "as expected" at the moment!
Thanks for the screenshot. Yes, seeing the real version number here is definitely an improvement. And yes, it's expected that this PR does not solve all update problems on Android. While I had hoped for this to be the case, the PR doesn't claim to do it :)
BTW, if you want me to check any functionality on any new build let me know - I have several Android devices at my disposal, and can force a new build to install by uninstalling any old one, of course.
Great, thanks! I'll likely ask again as part of #2404.
android/AndroidManifest.xml uses specific macros (%%INSERT_VERSION...). Those macros are replaced by the ANDROID_VERSION_* qmake variables, which were previously unset and therefore defaulted to "1". This made it impossible to update the APK without uninstalling first. This commit populates these variables. The user-visible ANDROID_VERSION_NAME is set similar to VERSION for other platforms. The Android-internal ANDROID_VERSION_CODE is set to the number of git commits in the current branch. This seems to be the most straightforward solution which guarantees unique, increasing integers within the scope of the master branch. Feature branches will break this logic, so developers may still be required to uninstall/reinstall. In order to get the commit count, the autobuild Android logic had to be modified to fetch the repo in full depth instead of only the most-recent commit. Tested via `apktool d` and by checking `apktool.yml`. Related: jamulussoftware#1760
The variable was set globally, but is only required for the Android target. Git history does not show a specific reason for placing it globally (a3558aa).
Official docs suggest using DISTFILES: https://doc.qt.io/qt-5/deployment-android.html OTHER_FILES is undocumented, while DISTFILES is. https://doc.qt.io/qt-5/qmake-variable-reference.html#distfiles https://stackoverflow.com/questions/38102160/in-qt-when-should-you-use-resources-vs-distfiles-vs-other-files/38102991#38102991
e61419b
to
079a52a
Compare
@ann0see @softins IMO we could merge this soon. Android is still experimental and both |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't test it at the moment, but I think it's ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look ok, and I was able to install the apk on my phone. Settings:Apps reports the correct version number, and I can run the app. Some issues in the app itself to address, but they are not related to this PR, so can be investigated separately.
@pljones and another fix (prefixed with Android: now) |
Short description of changes
ANDROID_VERSION_{CODE,NAME}
%%INSERT_VERSION...
). Those macros are replaced by theANDROID_VERSION_*
qmake variables, which were previously unset and therefore defaulted to "1". This made it impossible to update the APK without uninstalling first according to Android: Package update installation fails #1760. This commit populates these variables.ANDROID_VERSION_NAME
is set similar toVERSION
for other platforms.ANDROID_VERSION_CODE
is set to the number of git commits in the current branch. This seems to be the most straightforward solution which guarantees unique, increasing integers within the scope of the master branch. Feature branches will break this logic, so developers may still be required to uninstall/reinstall.apktool d
and by checkingapktool.yml
.ANDROID_ABIS
to conditional (The variable was set globally, but is only required for the Android target. Git history does not show a specific reason for placing it globally (a3558aa).)DISTFILES
for AndroidManifest.xmlDISTFILES
: https://doc.qt.io/qt-5/deployment-android.htmlOTHER_FILES
is not documented, whileDISTFILES
is. https://doc.qt.io/qt-5/qmake-variable-reference.html#distfiles https://stackoverflow.com/questions/38102160/in-qt-when-should-you-use-resources-vs-distfiles-vs-other-files/38102991#38102991Context: Fixes an issue?
Related #1760 (but doesn't fix, it seems)
Does this change need documentation? What needs to be documented and how?
No.
CHANGELOG: Android: Package version has been fixed to show the actual release version.
Status of this Pull Request
Ready.
What is missing until this pull request can be merged?
Can be merged after 3.8.2.
Checklist
My code follows the style guide