Adapt apk building to Qt6

This commit is contained in:
Tobias Fella 2023-11-09 20:07:01 +01:00
parent 566780ab49
commit 60c260b4ac
No known key found for this signature in database
GPG Key ID: E55EDAB3CA5D9925
4 changed files with 13 additions and 9 deletions

View File

@ -36,6 +36,7 @@ include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE) include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMAddAppIcon) include(ECMAddAppIcon)
include(ECMDeprecationSettings) include(ECMDeprecationSettings)
include(ECMAddAndroidApk)
if(NOT ANDROID) if(NOT ANDROID)
include(KDEClangFormat) include(KDEClangFormat)
endif() endif()

View File

@ -14,9 +14,9 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<application android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Kasts" android:icon="@mipmap/ic_launcher"> <application android:name="org.qtproject.qt.android.bindings.QtApplication" android:label="Kasts" android:icon="@mipmap/ic_launcher">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation"
android:name="org.qtproject.qt5.android.bindings.QtActivity" android:name="org.qtproject.qt.android.bindings.QtActivity"
android:label="Kasts" android:label="Kasts"
android:windowSoftInputMode="adjustResize" android:windowSoftInputMode="adjustResize"
android:launchMode="singleTop" android:launchMode="singleTop"

View File

@ -13,7 +13,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.0.2' classpath 'com.android.tools.build:gradle:7.4.1'
} }
} }
@ -36,7 +36,7 @@ android {
* The following variables: * The following variables:
* - androidBuildToolsVersion, * - androidBuildToolsVersion,
* - androidCompileSdkVersion * - androidCompileSdkVersion
* - qt5AndroidDir - holds the path to qt android files * - qtAndroidDir - holds the path to qt android files
* needed to build any Qt application * needed to build any Qt application
* on Android. * on Android.
* *
@ -45,17 +45,19 @@ android {
* Changing them manually might break the compilation! * Changing them manually might break the compilation!
*******************************************************/ *******************************************************/
compileSdkVersion androidCompileSdkVersion.toInteger() compileSdkVersion androidCompileSdkVersion
buildToolsVersion androidBuildToolsVersion buildToolsVersion androidBuildToolsVersion
ndkVersion androidNdkVersion ndkVersion androidNdkVersion
// Extract native libraries from the APK
packagingOptions.jniLibs.useLegacyPackaging true
sourceSets { sourceSets {
main { main {
manifest.srcFile 'AndroidManifest.xml' manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java'] java.srcDirs = [qtAndroidDir + '/src', 'src', 'java']
aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl'] aidl.srcDirs = [qtAndroidDir + '/src', 'src', 'aidl']
res.srcDirs = [qt5AndroidDir + '/res', 'res'] res.srcDirs = [qtAndroidDir + '/res', 'res']
resources.srcDirs = ['src'] resources.srcDirs = ['src']
renderscript.srcDirs = ['src'] renderscript.srcDirs = ['src']
assets.srcDirs = ['assets'] assets.srcDirs = ['assets']

View File

@ -261,6 +261,7 @@ if(ANDROID)
view-sort-descending-name view-sort-descending-name
view-sort-ascending-name view-sort-ascending-name
) )
ecm_add_android_apk(kasts ANDROID_DIR ${CMAKE_SOURCE_DIR}/android)
else() else()
target_link_libraries(kasts PRIVATE Qt::Widgets) target_link_libraries(kasts PRIVATE Qt::Widgets)
endif() endif()