This document provides detailed description of how to install, prepare and contribute to the App development as part of the "MORE"-Project.
This is an example of how you can set up the project locally. To get a local copy up and running follow these steps.
The following prerequisites list contains all the needed software in order to be able to build the app locally.
Disclaimer: To write iOS-specific code and run an iOS application on a simulated or real device, you'll need a Mac with macOS. This cannot be performed on other operating systems, such as Microsoft Windows. This is an Apple requirement.
It's recommended that you install the latest stable versions for compatibility and better performance. In order to build the iOS application the version of iOS should be at least 14.
Also, it's recommended to install the following plugins in the Android Studio directly:
Kotlin Multiplatform Mobile - In Android Studio, select Settings/Preferences | Plugins, search Marketplace for Kotlin Multiplatform Mobile, and then install it.
Kotlin plugin - The Kotlin plugin is bundled with each Android Studio release. However, it still needs to be updated to the latest version to avoid compatibility issues.
To update the plugin, on the Android Studio welcome screen, select Plugins | Installed. Click Update next to Kotlin. You can also check the Kotlin version in Tools | Kotlin | Configure Kotlin Plugin Updates. The Kotlin plugin should be compatible with the Kotlin Multiplatform Mobile plugin. Refer to the compatibility table.
The following is an instruction on how to install and configure the project on your local device.
git clone https://github.com/MORE-Platform/more-app-multiplatform.git
./gradlew build
To make sure everything works as expected, install and run the KDoctor tool:
In the Android Studio terminal or your command-line tool, run the following command to install the tool using Homebrew:
brew install kdoctor
If you don't have Homebrew yet, install it or see the KDoctor README for other ways to install it.
After the installation is completed, call KDoctor in the console:
kdoctor
If KDoctor diagnoses any problems while checking your environment, review the output for issues and possible solutions:
([x])
. You can find problem descriptions and potential solutions after the *
symbol.([!])
and successful messages ([v])
. They may contain useful notes and tips, as well.You may ignore KDoctor's warnings regarding the CocoaPods installation. In this project, we use Swift Package Manager and not CocoaPods.
In order to run your application you have to create an emulator device. Follow these steps to create an Android emulator:
After you have configured the emulator device for your project, you can run the application, which will start the emulator and install your application on it. After that you can use the emulator to test the app.
Because More App Multiplatform supports iOS and Android, you can choose which application and the corresponding emulator you want to run.
The purpose of the Kotlin Multiplatform Mobile technology is unifying the development of applications with common logic for Android and iOS platforms. To make this possible, it uses a mobile-specific structure of Kotlin Multiplatform projects.
To view the complete structure of your mobile multiplatform project, switch the view from Android to Project.
The root project is a Gradle project that holds the shared module and the Android application as its subprojects. They are linked together via the Gradle multi-project mechanism.
The iOS application is produced from an Xcode project. It's stored in a separate directory within the root project. Xcode uses its own build system; thus, the iOS application project isn't connected with other parts of the Multiplatform Mobile project via Gradle. Instead, it uses the shared module as an external artifact – framework. For details on integration between the shared module and the iOS application, see iOS application.
The root project does not hold source code. You can use it to store global configuration in its build.gradle(.kts)
or gradle.properties
, for example, add repositories or define global configuration variables.
Shared module contains the core application logic used in both Android and iOS target platforms: classes, functions, and so on. This is a Kotlin Multiplatform module that compiles into an Android library and an iOS framework. It uses the Gradle build system with the Kotlin Multiplatform plugin applied and has targets for Android and iOS.
plugins {
kotlin("multiplatform") version "1.8.10"
// ..
}
kotlin {
android()
ios()
}
The shared module contains the code that is common for Android and iOS applications. However, to implement the same logic on Android and iOS, you sometimes need to write two platform-specific versions of it. To handle such cases, Kotlin offers the expect/actual mechanism. The source code of the shared module is organized in three source sets accordingly:
commonMain
stores the code that works on both platforms, including the expect
declarationsandroidMain
stores Android-specific parts, including actual
implementationsiosMain
stores iOS-specific parts, including actual
implementationsAs the mobile phone operating systems are attempting to limit unintended application data access and background activities for privacy and battery preservation, as well as for overall performance reasons, please consider checking through operating system settings that:
Apache 2.0 with Commons Clause; see LICENSE.txt for further details
Ludwig Boltzmann Institute for Digital Health and Prevention - more-health.at - more@dhp.lbg.ac.at