Skip to content

Android: Incomplete Qt6 support#2533

Closed
hoffie wants to merge 5 commits intojamulussoftware:masterfrom
hoffie:Qt6-android
Closed

Android: Incomplete Qt6 support#2533
hoffie wants to merge 5 commits intojamulussoftware:masterfrom
hoffie:Qt6-android

Conversation

@hoffie
Copy link
Copy Markdown
Member

@hoffie hoffie commented Mar 21, 2022

Short description of changes

I'm creating this PR to document and archive the needed steps to get Android built with Qt6. Sadly, I'm hitting a dead end and will not continue this PR for now.

This PR is based on #2527. Until that PR is merged, its changed will show up here as well.

State of this PR:

  • Qt archive updates: Qt5 provided packages for all 4 common Android ABIs. Qt6 requires installation of individual packages. In addition, it requires installation of the desktop Linux qtbase package in order to have a matching qmake binary. In addition that requires the Qt icu build because standard Debian(Ubuntu versions don't fit.
  • Qt6 uses Gradle 7.2 which requires Java 11
  • Qt6 requires the Debian package libglib2.0.0-0
  • Qt6 removes several features from the AndroidManifest.xml logic. They can simply be dropped..
    • Most other code has been hidden behind version checks, while this change hasn't. I'm not sure what it causes for Qt5.
      CHANGELOG:
  • Jamulus uses QtAndroid (qtandroidextras package). Qt6 no longer ships that. The workaround is using the private API instead. This requires QT += core-private, it requires a #define QtAndroid QtAndroidPrivate and other ugly logic. Even after that, it won't work out of the box as types are slightly different and *sync API versions have been dropped. Those changes are no longer part of the PR. I tried dropping the Android-specific code altogether in favor of adding the required permission (RECORD_AUDIO) directly to the AndroidManifest.xml.
    • I suspect that this might not work as there are hints that some permissions (and maybe exactly this one) are only granted when the App asks explicitly.
  • Qt6 requires minSdkVersion=23 which has been bumped accordingly.
  • Qt6 drops support for building muti-ABI APKs in one go via ANDROID_ABIS. There's no plan to re-add this feature for qmake-based builds. 6.3.0 re-adds support for this, but only for cmake-based projects.. This is the main reason why I stopped with this PR. I don't see a sane way forward. Some ideas for the future:
    • Attempt to generate a single APK from multiple qmake/make runs. I tried that as part of the PR with no success. The necessary native libraries are built and kept there, but androiddeployqt still errors out.
    • There are docs for workarounds, which I haven't investigated yet: https://codereview.qt-project.org/c/qt/qtdoc/+/372498/7/doc/src/platforms/android/android-publishing-to-googleplay.qdoc
    • We could consider switching to cmake (at least for Android). It seems like the future of qmake is a bit unclear for post-Qt6 anyway.
    • We could stop distributing a single .apk and would distribute separate .apks instead (better build times, but worse user experience)

Context: Fixes an issue?

Qt6 support.

Status of this Pull Request

Broken and won't be fixed in the short term.

What is missing until this pull request can be merged?

Multi-ABI support, see above.

hoffie added 5 commits March 19, 2022 22:04
Related: jamulussoftware#2503

- Move all autobuild/android/* scripts to a single
  .github/autobuild/android.sh script which is called for the different stages
  (setup/build/get-artifacts).

- Create functions with proper names for larger steps

- Inline Github artifact output definition as it's shorter that way

- Make shellcheck-clean

- Drop wget dependency and use curl for all downloads

- Keep variables as local as possible; only export what's necessary

- Move further hardcoded versions to variables

- Move build output to build/

- Drop dependencies libxkbcommon-x11-0 (unused) and openjdk-8-jre-headless (covered via jdk)
Now that all platforms have been converted to the new scheme
(.github/autobuild/*), the autobuild directory only contains the
ensure_THIS_JAMULUS_PROJECT_PATH.sh script which is no longer used.

Related: jamulussoftware#2521
Qt6 no longer ships qtandroidextras. As of 6.2, there is no replacement
either. The official workaround is to use the private headers which still
contain the APIs we need:
https://bugreports.qt.io/browse/QTBUG-84382?focusedCommentId=566019&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-566019

Fixes jamulussoftware#2528
This is still broken.
The main reason is that Qt6 no longer supports building multiple
ANDROID_ABIS in one go.
This commit includes some attempts to work around this, but they don't
work.
Individual builds do work though.
@hoffie hoffie marked this pull request as draft March 21, 2022 20:30
@hoffie
Copy link
Copy Markdown
Member Author

hoffie commented Mar 21, 2022

As noted in the description, this PR has only been created for archival reasons. Therefore, I'm closing it.

@hoffie hoffie closed this Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant