aboutsummaryrefslogtreecommitdiffstats
path: root/examples/platforms
diff options
context:
space:
mode:
authorKonsta Alajärvi <konsta.alajarvi@qt.io>2024-03-21 14:30:49 +0200
committerKonsta Alajärvi <konsta.alajarvi@qt.io>2024-05-02 13:17:15 +0300
commite8060eac72e9c37cba5720e934dc1d4d6ed9b81a (patch)
treec1855c23544eab21ce7241a56f87f7e3e83fe526 /examples/platforms
parent3f3787a6b4f54f2603598e49eeebb58532aa2afa (diff)
Add example showcasing embedding QML to native Android Kotlin project
Add new project folder qml_in_kotlin_based_android_project which include the new Android Studio project. Fixes: QTBUG-120717 Pick-to: 6.7 Change-Id: I53023c897c92d275018b4e40ab84a3b60e0afa1f Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Diffstat (limited to 'examples/platforms')
-rw-r--r--examples/platforms/android/.gitignore14
-rw-r--r--examples/platforms/android/CMakeLists.txt1
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/CMakeLists.txt18
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/build.gradle64
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/AndroidManifest.xml26
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/java/com/example/qml_in_kotlin_based_android_project/Colors.kt31
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/java/com/example/qml_in_kotlin_based_android_project/MainActivity.kt138
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/drawable/ic_launcher_background.xml74
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/drawable/ic_launcher_foreground.xml30
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/layout/activity_main.xml164
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml6
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml6
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-hdpi/ic_launcher.webpbin0 -> 4118 bytes
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webpbin0 -> 8980 bytes
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-hdpi/ic_launcher_round.webpbin0 -> 6056 bytes
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-mdpi/ic_launcher.webpbin0 -> 2650 bytes
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webpbin0 -> 5556 bytes
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-mdpi/ic_launcher_round.webpbin0 -> 3680 bytes
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xhdpi/ic_launcher.webpbin0 -> 5924 bytes
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webpbin0 -> 13218 bytes
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webpbin0 -> 8836 bytes
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxhdpi/ic_launcher.webpbin0 -> 10144 bytes
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webpbin0 -> 25688 bytes
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webpbin0 -> 14828 bytes
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webpbin0 -> 14820 bytes
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webpbin0 -> 41052 bytes
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webpbin0 -> 21224 bytes
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/values/colors.xml10
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/values/strings.xml12
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/values/styles.xml6
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/values/themes.xml16
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/xml/backup_rules.xml13
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/xml/data_extraction_rules.xml19
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/build.gradle5
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/gradle.properties23
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/gradle/wrapper/gradle-wrapper.properties6
-rw-r--r--examples/platforms/android/qml_in_kotlin_based_android_project/settings.gradle17
37 files changed, 692 insertions, 7 deletions
diff --git a/examples/platforms/android/.gitignore b/examples/platforms/android/.gitignore
index 59cf3f824f..e1bb0d95b4 100644
--- a/examples/platforms/android/.gitignore
+++ b/examples/platforms/android/.gitignore
@@ -1,10 +1,10 @@
*.user
build/
-qml_in_java_based_android_project/.idea/
-qml_in_java_based_android_project/.gradle/
-qml_in_java_based_android_project/local.properties
-qml_in_java_based_android_project/app/libs/
-qml_in_java_based_android_project/app/src/main/res/xml/qtprovider_paths.xml
-qml_in_java_based_android_project/app/src/main/res/values/libs.xml
-qml_in_java_based_android_project/app/assets/android_rcc_bundle.rcc
+**/.idea/
+**/.gradle/
+**/local.properties
+**/app/libs/
+**/app/src/main/res/xml/qtprovider_paths.xml
+**/app/src/main/res/values/libs.xml
+**/app/assets/android_rcc_bundle.rcc
diff --git a/examples/platforms/android/CMakeLists.txt b/examples/platforms/android/CMakeLists.txt
index 2cff669bdc..7ed54f821d 100644
--- a/examples/platforms/android/CMakeLists.txt
+++ b/examples/platforms/android/CMakeLists.txt
@@ -3,3 +3,4 @@
qt_internal_add_example(qml_in_android_view)
qt_internal_add_example(qml_in_java_based_android_project)
+qt_internal_add_example(qml_in_kotlin_based_android_project)
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/CMakeLists.txt b/examples/platforms/android/qml_in_kotlin_based_android_project/CMakeLists.txt
new file mode 100644
index 0000000000..efa2575b8f
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+cmake_minimum_required(VERSION 3.16)
+
+project(qml_in_kotlin_based_android_project VERSION 0.1 LANGUAGES CXX)
+
+install(DIRECTORY
+ gradle
+ app
+ DESTINATION .
+)
+install(FILES
+ settings.gradle
+ gradle.properties
+ build.gradle
+ CMakeLists.txt
+ DESTINATION .
+)
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/build.gradle b/examples/platforms/android/qml_in_kotlin_based_android_project/app/build.gradle
new file mode 100644
index 0000000000..be631746b6
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/build.gradle
@@ -0,0 +1,64 @@
+plugins {
+ id 'com.android.application'
+ id 'org.jetbrains.kotlin.android'
+}
+
+android {
+ namespace 'com.example.qml_in_kotlin_based_android_project'
+ compileSdk 34
+
+ defaultConfig {
+ applicationId "com.example.qml_in_kotlin_based_android_project"
+ minSdk 26
+ targetSdk 34
+ versionCode 1
+ versionName "1.0"
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ buildFeatures {
+ viewBinding = true
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+ kotlinOptions {
+ jvmTarget = '1.8'
+ }
+ packagingOptions {
+ jniLibs {
+ useLegacyPackaging true
+ }
+ }
+ sourceSets {
+ main {
+ assets {
+ srcDirs 'assets'
+ }
+ jniLibs {
+ srcDirs 'libs'
+ }
+ }
+ }
+}
+
+dependencies {
+
+ implementation 'androidx.core:core-ktx:1.10.1'
+ implementation 'androidx.appcompat:appcompat:1.6.1'
+ implementation 'com.google.android.material:material:1.11.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
+ implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
+ testImplementation 'junit:junit:4.13.2'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.5'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
+}
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/AndroidManifest.xml b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..fb183e2d79
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/AndroidManifest.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools">
+
+ <application
+ android:allowBackup="true"
+ android:dataExtractionRules="@xml/data_extraction_rules"
+ android:fullBackupContent="@xml/backup_rules"
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:roundIcon="@mipmap/ic_launcher_round"
+ android:supportsRtl="true"
+ android:theme="@style/Theme.Qml_in_kotlin_based_android_project"
+ tools:targetApi="34">
+ <activity
+ android:name=".MainActivity"
+ android:exported="true"
+ android:configChanges="screenSize|screenLayout|orientation">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/java/com/example/qml_in_kotlin_based_android_project/Colors.kt b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/java/com/example/qml_in_kotlin_based_android_project/Colors.kt
new file mode 100644
index 0000000000..7770497796
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/java/com/example/qml_in_kotlin_based_android_project/Colors.kt
@@ -0,0 +1,31 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+package com.example.qml_in_kotlin_based_android_project
+
+import java.util.Collections
+import java.util.Stack
+
+internal class Colors {
+ private val recycle: Stack<Int> = Stack()
+ private val colors: Stack<Int> = Stack()
+
+ init {
+ recycle.addAll(
+ mutableListOf(
+ -0xe34997, -0xffbeb6, -0xd8ec75,
+ -0x4a3ef2, -0xc8c0da, -0x506c21,
+ -0x7e8afb
+ )
+ )
+ }
+
+ fun getColor(): String {
+ if (colors.size == 0) {
+ while (!recycle.isEmpty()) colors.push(recycle.pop())
+ Collections.shuffle(colors)
+ }
+ val color = colors.pop()
+ recycle.push(color)
+ return String.format("#%06X", 0xFFFFFF and color)
+ }
+}
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/java/com/example/qml_in_kotlin_based_android_project/MainActivity.kt b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/java/com/example/qml_in_kotlin_based_android_project/MainActivity.kt
new file mode 100644
index 0000000000..339eea40fe
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/java/com/example/qml_in_kotlin_based_android_project/MainActivity.kt
@@ -0,0 +1,138 @@
+package com.example.qml_in_kotlin_based_android_project
+
+import android.content.res.Configuration
+import android.graphics.Color
+import android.os.Bundle
+import android.util.DisplayMetrics
+import android.util.Log
+import android.view.ViewGroup
+import android.widget.FrameLayout
+import android.widget.LinearLayout
+import androidx.appcompat.app.AppCompatActivity
+import com.example.qml_in_kotlin_based_android_project.databinding.ActivityMainBinding
+import org.qtproject.qt.android.QtQuickView
+
+class MainActivity : AppCompatActivity(), QtQuickView.StatusChangeListener {
+
+ private val TAG = "myTag"
+ private val m_colors: Colors = Colors()
+ private lateinit var m_binding: ActivityMainBinding
+ private var m_qmlButtonSignalListenerId = 0
+ private var m_qmlView: QtQuickView? = null
+ private val m_statusNames = hashMapOf(
+ QtQuickView.STATUS_READY to "READY",
+ QtQuickView.STATUS_LOADING to "LOADING",
+ QtQuickView.STATUS_ERROR to "ERROR",
+ QtQuickView.STATUS_NULL to "NULL"
+ )
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ m_binding = ActivityMainBinding.inflate(layoutInflater)
+ val view = m_binding.root
+ setContentView(view)
+
+ m_binding.signalSwitch.setOnClickListener { switchListener() }
+
+ m_qmlView = QtQuickView(
+ this, "qrc:/qt/qml/qml_in_android_view/main.qml",
+ "qml_in_android_view"
+ )
+ // Set status change listener for m_qmlView
+ // listener implemented below in OnStatusChanged
+ m_qmlView!!.setStatusChangeListener(this)
+ val params: ViewGroup.LayoutParams = FrameLayout.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
+ )
+ m_binding.qmlFrame.addView(m_qmlView, params)
+
+ m_binding.changeColorButton.setOnClickListener { onClickListener() }
+
+ // Check target device orientation on launch
+ handleOrientationChanges()
+ }
+
+ override fun onConfigurationChanged(newConfig: Configuration) {
+ super.onConfigurationChanged(newConfig)
+ handleOrientationChanges()
+ }
+
+ private fun handleOrientationChanges() {
+ // When specific target device display configurations (listed in AndroidManifest.xml
+ // android:configChanges) change, get display metrics and make needed changes to UI
+ val displayMetrics = DisplayMetrics()
+ windowManager.defaultDisplay.getMetrics(displayMetrics)
+ val qmlFrameLayoutParams = m_binding.qmlFrame.layoutParams
+ val linearLayoutParams = m_binding.kotlinLinear.layoutParams
+
+ if (displayMetrics.heightPixels > displayMetrics.widthPixels) {
+ m_binding.mainLinear.orientation = LinearLayout.VERTICAL
+ qmlFrameLayoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT
+ qmlFrameLayoutParams.height = 0
+ linearLayoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT
+ linearLayoutParams.height = 0
+ } else {
+ m_binding.mainLinear.orientation = LinearLayout.HORIZONTAL
+ qmlFrameLayoutParams.width = 0
+ qmlFrameLayoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
+ linearLayoutParams.width = 0
+ linearLayoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
+ }
+ m_binding.qmlFrame.layoutParams = qmlFrameLayoutParams
+ m_binding.kotlinLinear.layoutParams = linearLayoutParams
+ }
+
+ private fun onClickListener() {
+ // Set the QML view root object property "colorStringFormat" value to
+ // color from Colors.getColor()
+ m_qmlView!!.setProperty("colorStringFormat", m_colors.getColor())
+
+ val qmlBackgroundColor = m_qmlView!!.getProperty<String>("colorStringFormat")
+
+ // Display the QML View background color code
+ m_binding.getPropertyValueText.text = qmlBackgroundColor
+
+ // Display the QML View background color in a view
+ m_binding.colorBox.setBackgroundColor(Color.parseColor(qmlBackgroundColor))
+ }
+
+ private fun switchListener() {
+ // Disconnect QML button signal listener if switch is On using the saved signal listener Id
+ // and connect it again if switch is turned off
+ if (m_binding.signalSwitch.isChecked) {
+ Log.v(TAG, "QML button onClicked signal listener disconnected")
+ m_binding.switchText.setText(R.string.connect_qml_button_signal_listener)
+ m_qmlView!!.disconnectSignalListener(m_qmlButtonSignalListenerId)
+ } else {
+ Log.v(TAG, "QML button onClicked signal listener connected")
+ m_binding.switchText.setText(R.string.disconnect_qml_button_signal_listener)
+ m_qmlButtonSignalListenerId = m_qmlView!!.connectSignalListener<Any>(
+ "onClicked",
+ Any::class.java
+ ) { t: String?, value: Any? ->
+ Log.i(TAG, "QML button clicked")
+ m_binding.kotlinLinear.setBackgroundColor(Color.parseColor(m_colors.getColor()))
+ }
+ }
+ }
+
+ override fun onStatusChanged(status: Int) {
+ Log.v(TAG, "Status of QtQuickView: $status")
+
+ val qmlStatus = (resources.getString(R.string.qml_view_status)
+ + m_statusNames[status])
+
+ // Show current QML View status in a textview
+ m_binding.qmlStatus.text = qmlStatus
+
+ // Connect signal listener to "onClicked" signal from main.qml
+ // addSignalListener returns int which can be used later to identify the listener
+ if (status == QtQuickView.STATUS_READY && !m_binding.signalSwitch.isChecked) {
+ m_qmlButtonSignalListenerId = m_qmlView!!.connectSignalListener(
+ "onClicked", Any::class.java
+ ) { _: String?, _: Any? ->
+ Log.v(TAG, "QML button clicked")
+ m_binding.kotlinLinear.setBackgroundColor(Color.parseColor(m_colors.getColor()))
+ }
+ }
+ }
+}
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/drawable/ic_launcher_background.xml b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000000..ca3826a46c
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<vector
+ android:height="108dp"
+ android:width="108dp"
+ android:viewportHeight="108"
+ android:viewportWidth="108"
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="#3DDC84"
+ android:pathData="M0,0h108v108h-108z"/>
+ <path android:fillColor="#00000000" android:pathData="M9,0L9,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M19,0L19,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M29,0L29,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M39,0L39,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M49,0L49,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M59,0L59,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M69,0L69,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M79,0L79,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M89,0L89,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M99,0L99,108"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,9L108,9"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,19L108,19"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,29L108,29"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,39L108,39"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,49L108,49"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,59L108,59"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,69L108,69"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,79L108,79"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,89L108,89"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M0,99L108,99"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M19,29L89,29"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M19,39L89,39"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M19,49L89,49"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M19,59L89,59"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M19,69L89,69"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M19,79L89,79"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M29,19L29,89"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M39,19L39,89"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M49,19L49,89"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M59,19L59,89"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M69,19L69,89"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+ <path android:fillColor="#00000000" android:pathData="M79,19L79,89"
+ android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+</vector>
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/drawable/ic_launcher_foreground.xml b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 0000000000..7706ab9e6d
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,30 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:aapt="http://schemas.android.com/aapt"
+ android:width="108dp"
+ android:height="108dp"
+ android:viewportWidth="108"
+ android:viewportHeight="108">
+ <path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
+ <aapt:attr name="android:fillColor">
+ <gradient
+ android:endX="85.84757"
+ android:endY="92.4963"
+ android:startX="42.9492"
+ android:startY="49.59793"
+ android:type="linear">
+ <item
+ android:color="#44000000"
+ android:offset="0.0" />
+ <item
+ android:color="#00000000"
+ android:offset="1.0" />
+ </gradient>
+ </aapt:attr>
+ </path>
+ <path
+ android:fillColor="#FFFFFF"
+ android:fillType="nonZero"
+ android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
+ android:strokeWidth="1"
+ android:strokeColor="#00000000" />
+</vector>
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/layout/activity_main.xml b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000000..03f01fdd25
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/mainLinear"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".MainActivity"
+ android:orientation="vertical"
+ android:baselineAligned="false">
+
+ <FrameLayout
+ android:id="@+id/qmlFrame"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1">
+
+ </FrameLayout>
+
+ <LinearLayout
+ android:id="@+id/kotlinLinear"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:background="@color/lilac"
+ android:orientation="vertical">
+
+
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginTop="8dp"
+ android:gravity="center_horizontal"
+ android:includeFontPadding="false"
+ android:text="@string/kotlin"
+ android:textColor="@color/white"
+ android:textSize="24sp"
+ android:textStyle="bold" />
+
+ <TextView
+ android:id="@+id/qmlStatus"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginTop="16dp"
+ android:gravity="center_horizontal"
+ android:text="@string/qml_view_status"
+ android:textColor="@color/white"/>
+
+ <LinearLayout
+ android:id="@+id/buttonAndSwitchLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:gravity="center_horizontal"
+ android:orientation="horizontal"
+ android:layout_marginTop="16dp">
+
+ <LinearLayout
+ android:id="@+id/buttonLinearLayout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:layout_weight="1">
+
+ <TextView
+ android:id="@+id/changeColorText"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:gravity="center_horizontal"
+ android:maxLines="3"
+ android:text="@string/change_qml_background"
+ android:textColor="@color/white" />
+
+ <Button
+ android:id="@+id/changeColorButton"
+ android:layout_width="100dp"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginTop="8dp"
+ android:text="@string/button"
+ android:textSize="14sp" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/switchLinearLayout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:layout_weight="1">
+
+ <TextView
+ android:id="@+id/switchText"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:gravity="center_horizontal"
+ android:maxLines="3"
+ android:text="@string/disconnect_qml_button_signal_listener"
+ android:textColor="@color/white" />
+
+ <androidx.appcompat.widget.SwitchCompat
+ android:id="@+id/signalSwitch"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginTop="8dp"
+ android:switchTextAppearance="@android:style/TextAppearance.Small"
+ android:textOff="@string/off"
+ android:textOn="@string/on"
+ app:switchTextAppearance="@style/switchStyle"
+ app:showText="true"
+ tools:ignore="UseSwitchCompatOrMaterialXml" />
+ </LinearLayout>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/qmlColorLinear"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal"
+ android:padding="10dp">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:layout_weight="1">
+
+ <TextView
+ android:id="@+id/qmlViewBackgroundText"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:gravity="center_horizontal"
+ android:maxLines="2"
+ android:text="@string/qml_view_background_color"
+ android:textColor="@color/white" />
+
+ <TextView
+ android:id="@+id/getPropertyValueText"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:gravity="center_horizontal"
+ android:textColor="@color/white" />
+ </LinearLayout>
+
+ <View
+ android:id="@+id/colorBox"
+ android:layout_width="100dp"
+ android:layout_height="50dp"
+ android:layout_gravity="center_horizontal"
+ android:background="@android:color/transparent"
+ android:layout_weight="0"/>
+ </LinearLayout>
+
+ </LinearLayout>
+
+</LinearLayout>
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000000..3ff874648d
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@drawable/ic_launcher_background"/>
+ <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
+</adaptive-icon>
+
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000000..3ff874648d
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@drawable/ic_launcher_background"/>
+ <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
+</adaptive-icon>
+
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-hdpi/ic_launcher.webp
new file mode 100644
index 0000000000..f043b66984
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-hdpi/ic_launcher.webp
Binary files differ
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp
new file mode 100644
index 0000000000..53e483046c
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp
Binary files differ
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
new file mode 100644
index 0000000000..5646cd4957
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Binary files differ
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-mdpi/ic_launcher.webp
new file mode 100644
index 0000000000..8121c6f7c2
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-mdpi/ic_launcher.webp
Binary files differ
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp
new file mode 100644
index 0000000000..da81ab2c05
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp
Binary files differ
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
new file mode 100644
index 0000000000..d68eb57118
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Binary files differ
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
new file mode 100644
index 0000000000..818fa2b2dc
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Binary files differ
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp
new file mode 100644
index 0000000000..57d6591183
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp
Binary files differ
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000000..cf05b107f0
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Binary files differ
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
new file mode 100644
index 0000000000..30855a994a
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Binary files differ
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp
new file mode 100644
index 0000000000..385517a7eb
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp
Binary files differ
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000000..10ec83e5f4
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Binary files differ
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
new file mode 100644
index 0000000000..5a9dab1d44
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Binary files differ
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp
new file mode 100644
index 0000000000..62d203c390
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp
Binary files differ
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000000..52d2c11162
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Binary files differ
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/values/colors.xml b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000000..d38e4ce6b3
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/values/colors.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="purple_500">#FF6200EE</color>
+ <color name="purple_700">#FF3700B3</color>
+ <color name="teal_200">#FF03DAC5</color>
+ <color name="teal_700">#FF018786</color>
+ <color name="black">#FF000000</color>
+ <color name="white">#FFFFFFFF</color>
+ <color name="lilac">#AF93DF</color>
+</resources>
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/values/strings.xml b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000000..12661a6334
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/values/strings.xml
@@ -0,0 +1,12 @@
+<resources>
+ <string name="app_name">qml_in_kotlin_based_android_project</string>
+ <string name="button">Change color</string>
+ <string name="kotlin">Kotlin</string>
+ <string name="change_qml_background">Tap button to change QML view background color</string>
+ <string name="disconnect_qml_button_signal_listener">Tap switch to disconnect QML button signal listener</string>
+ <string name="connect_qml_button_signal_listener">Tap switch to connect QML button signal listener</string>
+ <string name="on">On</string>
+ <string name="off">Off</string>
+ <string name="qml_view_status">QML view status: </string>
+ <string name="qml_view_background_color">QML view background color:</string>
+</resources>
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/values/styles.xml b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000000..bce864063a
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/values/styles.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <style name="switchStyle">
+ <item name="android:textSize">12sp</item>
+ </style>
+</resources>
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/values/themes.xml b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/values/themes.xml
new file mode 100644
index 0000000000..b501d7b323
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/values/themes.xml
@@ -0,0 +1,16 @@
+<resources xmlns:tools="http://schemas.android.com/tools">
+ <!-- Base application theme. -->
+ <style name="Theme.Qml_in_kotlin_based_android_project" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
+ <!-- Primary brand color. -->
+ <item name="colorPrimary">@color/purple_500</item>
+ <item name="colorPrimaryVariant">@color/purple_700</item>
+ <item name="colorOnPrimary">@color/white</item>
+ <!-- Secondary brand color. -->
+ <item name="colorSecondary">@color/teal_200</item>
+ <item name="colorSecondaryVariant">@color/teal_700</item>
+ <item name="colorOnSecondary">@color/black</item>
+ <!-- Status bar color. -->
+ <item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
+ <!-- Customize your theme here. -->
+ </style>
+</resources>
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/xml/backup_rules.xml b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/xml/backup_rules.xml
new file mode 100644
index 0000000000..148c18b659
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/xml/backup_rules.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ Sample backup rules file; uncomment and customize as necessary.
+ See https://developer.android.com/guide/topics/data/autobackup
+ for details.
+ Note: This file is ignored for devices older that API 31
+ See https://developer.android.com/about/versions/12/backup-restore
+-->
+<full-backup-content>
+ <!--
+ <include domain="sharedpref" path="."/>
+ <exclude domain="sharedpref" path="device.xml"/>
+-->
+</full-backup-content>
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/xml/data_extraction_rules.xml b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/xml/data_extraction_rules.xml
new file mode 100644
index 0000000000..0c4f95cab9
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/app/src/main/res/xml/data_extraction_rules.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ Sample data extraction rules file; uncomment and customize as necessary.
+ See https://developer.android.com/about/versions/12/backup-restore#xml-changes
+ for details.
+-->
+<data-extraction-rules>
+ <cloud-backup>
+ <!-- TODO: Use <include> and <exclude> to control what is backed up.
+ <include .../>
+ <exclude .../>
+ -->
+ </cloud-backup>
+ <!--
+ <device-transfer>
+ <include .../>
+ <exclude .../>
+ </device-transfer>
+ -->
+</data-extraction-rules>
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/build.gradle b/examples/platforms/android/qml_in_kotlin_based_android_project/build.gradle
new file mode 100644
index 0000000000..97e3f23ff2
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/build.gradle
@@ -0,0 +1,5 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+plugins {
+id 'com.android.application' version '8.2.2' apply false
+ id 'org.jetbrains.kotlin.android' version '1.9.22' apply false
+}
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/gradle.properties b/examples/platforms/android/qml_in_kotlin_based_android_project/gradle.properties
new file mode 100644
index 0000000000..2cbd6d19d3
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/gradle.properties
@@ -0,0 +1,23 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Kotlin code style for this project: "official" or "obsolete":
+kotlin.code.style=official
+# Enables namespacing of each library's R class so that its R class includes only the
+# resources declared in the library itself and none from the library's dependencies,
+# thereby reducing the size of the R class for that library
+android.nonTransitiveRClass=true
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/gradle/wrapper/gradle-wrapper.properties b/examples/platforms/android/qml_in_kotlin_based_android_project/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000000..a3353773cb
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Thu Mar 21 11:14:46 EET 2024
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/examples/platforms/android/qml_in_kotlin_based_android_project/settings.gradle b/examples/platforms/android/qml_in_kotlin_based_android_project/settings.gradle
new file mode 100644
index 0000000000..a30bfe06d0
--- /dev/null
+++ b/examples/platforms/android/qml_in_kotlin_based_android_project/settings.gradle
@@ -0,0 +1,17 @@
+pluginManagement {
+ repositories {
+ google()
+ mavenCentral()
+ gradlePluginPortal()
+ }
+}
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+
+rootProject.name = "qml_in_kotlin_based_android_project"
+include ':app'