Android API - 35 issues in Qt 5.15.2
-
This is required as per Google Play store policy to Update your target API level by August 31, 2025 to API level 35 or above. To update to the API level 35, I set ANDROID_TARGET_SDK_VERSION = 35 in my pro file in qt 5.15.2 - Android and compiled and built successfully and also uploaded to play store successfully.
But when this App is downloaded to Android- 15 devices, the App opens but its top tool bar is clipped.
The same app when installed on Android-14 devices works fine.
Does anybody facing the same issue and found a solution?Thanks in advance.
-
This is a change by Google. Apps with API Level 35 running on Android 15 devices now are always edge-to-edge and so your toolbar is clipped.
https://developer.android.com/develop/ui/views/layout/edge-to-edge
starting with Qt 6.9, Qt provides Safe Areas:
https://www.qt.io/blog/expanded-client-areas-and-safe-areas-in-qt-6.9
on Qt 5.15 you can use MobileUI:
https://github.com/emericg/MobileUI
...and you're in luck, because you can delay it until API 36:
try out adding this in to your manifest:
<application
android:windowOptOutEdgeToEdgeEnforcement="true">
</application>
see also https://www.droidcon.com/2024/09/20/🚨-google-secretly-adds-opt-out-api-for-android-15s-edge-to-edge-behaviour-🚨/
and discussions at Qt Discord Server: https://discord.com/channels/457523061650882570/1017293621063602186/1392839200574799923
good luck -
Hi Ekkehard Gentz.
Below solution didn't work
<application
android:windowOptOutEdgeToEdgeEnforcement="true">
</application>Below is the Error-
---\android-build\build\intermediates\packaged_manifests\release\AndroidManifest.xml:81: error: attribute android:windowOptOutEdgeToEdgeEnforcement not found.
error: failed processing manifest.- Try:
Run with --stacktrace option to get the stack trace.
Run with --debug option to get more log output.
Run with --scan to get full insights.
==============================================================================2: Task failed with an exception.
-
What went wrong:
java.lang.StackOverflowError (no error message) -
Try:
Run with --stacktrace option to get the stack trace.
Run with --debug option to get more log output.
Run with --scan to get full insights.
============================================================================== -
@Stamp_it thx testing this.
so it seems you should try the other way by @bchimp as discussed at Qt Discord Server:
in your android templates directory under res/values/themes.xml you put this<resources xmlns:tools="http://schemas.android.com/tools"> <style name="Theme.rando" parent="android:Theme.DeviceDefault.DayNight"> <item name="android:windowOptOutEdgeToEdgeEnforcement">true</item> </style> </resources>
obviously change the style name to whatever you are using. then in AndroidManifest in the "application" part, add this:
android:theme="@style/Theme.rando"
have not tried by myself
-
@Stamp_it thx testing this.
so it seems you should try the other way by @bchimp as discussed at Qt Discord Server:
in your android templates directory under res/values/themes.xml you put this<resources xmlns:tools="http://schemas.android.com/tools"> <style name="Theme.rando" parent="android:Theme.DeviceDefault.DayNight"> <item name="android:windowOptOutEdgeToEdgeEnforcement">true</item> </style> </resources>
obviously change the style name to whatever you are using. then in AndroidManifest in the "application" part, add this:
android:theme="@style/Theme.rando"
have not tried by myself
@ekkescorner Ok, Thanks for replying, I will check this out.
-
@ekkescorner Ok, Thanks for replying, I will check this out.
@Stamp_it if it also doesn't work, then probably because you need newer templates as used by Qt 6 ?
then you should consider to use MobileUI, which is working on Qt 5.15 and Qt 6. -
@Stamp_it if it also doesn't work, then probably because you need newer templates as used by Qt 6 ?
then you should consider to use MobileUI, which is working on Qt 5.15 and Qt 6.@ekkescorner Thank for replying.
Now I am working in Qt6.6.3, With Android -35, Built the application Successfully, But on android device it shows only a white blank screen with the Name of the application at the top -
@ekkescorner Thank for replying.
Now I am working in Qt6.6.3, With Android -35, Built the application Successfully, But on android device it shows only a white blank screen with the Name of the application at the top -
@Stamp_it would also recommend to use 6.9.1
-
And here's what Qt says, if you want to opt-out from Android-35 edge-to-edge:
you have to add styles.xml and add in Manifest... activity... android:theme="@style/NormalTheme"
see the details here:
https://codereview.qt-project.org/c/qt/qtbase/+/630376