Qt6.5.0: Resource theme link error
Solved
Qt 6
-
I try to port an app for Android running with Qt5.15 to Qt6.5.0. The code is already ported and compiles fine. Everything but the manifest file seems to compile. I fixed the
qt5
part in the paths. Here is the top of my manifest file<?xml version="1.0"?> <manifest package="org.qtproject.theosys" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:installLocation="auto" android:requestLegacyExternalStorage="true"> <!-- %%INSERT_PERMISSIONS --> <!-- %%INSERT_FEATURES --> <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> <application android:hardwareAccelerated="true" android:name="org.qtproject.android.qt.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:extractNativeLibs="true" android:requestLegacyExternalStorage="true" android:allowNativeHeapPointerTagging="false" android:allowBackup="true" android:fullBackupOnly="false" android:icon="@drawable/icon" android:theme="@style/Theme.AppCompat.NoActionBar"> <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:launchMode="singleTop" android:screenOrientation="nosensor" android:exported="true"> [...]
And here is the error I get:
FAILURE: Build completed with 2 failures. 1: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':processReleaseResources'. > A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction > Android resource linking failed error: resource style/Theme.AppCompat.NoActionBar (aka org.qtproject.theosys:style/Theme.AppCompat.NoActionBar) not found. error: resource style/Theme.AppCompat.NoActionBar (aka org.qtproject.theosys:style/Theme.AppCompat.NoActionBar) not found. error: resource style/Theme.AppCompat (aka org.qtproject.theosys:style/Theme.AppCompat) not found. error: failed linking references. * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. ==============================================================================
What is wrong with the theme? It worked this way wth Qt5. What do I miss?
A.T.
-
I've to answer my own question. The problem was that I had do add a dependency to the file
build.gradle
. The section should look like:dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) implementation 'com.google.android.material:material:1.0.0' implementation 'androidx.preference:preference:1.1.0' }
The second dependency (
'androidx.preference:preference:1.1.0
) is necessary if you use the new setup system (preferences) from Android.A.T.
-