See build configuration for details on how to configure your build environment.
Keyman for Android has a minSdkVersion of 21 for Android 5.0 Lollipop
Keyman for Android (formerly named KMAPro) can be built from a command line (preferred) or Android Studio.
Building Keyman Web is a precursor for compiling KMEA, so verify your system has all the Minimum Web Compilation Requirements
Keyman for Android uses Sentry for crash reporting at a server https://sentry.keyman.com. The analytics for Debug are associated with an App Bundle ID com.tavultesoft.kmapro.debug
.
-
Launch a command prompt and cd to the directory keyman/android
-
Run the top level build script
./build.sh -debug
which will:- Compile KMEA (and its KMW dependency)
- Download default keyboard and dictionary resources as needed
- Compile KMAPro
- Note: to force an update to the latest keyboard and dictionary packages, use the
-download-resources
flag.
-
The APK will be found in keyman/android/KMAPro/kMAPro/build/outputs/apk/debug/kMAPro-debug.apk
- Ensure that Keyman Engine for Android is built.
- Launch Android Studio and import the Gradle project keyman/android/KMAPro/build.gradle
- From the project view, configure anything that Gradle reports.
- Create a run configuration for kMAPro
- Select Run --> Edit Configurations...
- Select Add New Configuration (+) --> Android App
- Change Module to kMAPro
- Name your run configuration kMAPro (or as desired)
- Run your new configuration: Select Run --> Run 'kMAPro'
- Select a physical device or create a new virtual device to match your target API version
For Ubuntu 18.04, you will need to add your user to the
kvm
group for permission accessing the emulator.
sudo apt install qemu-kvm
sudo adduser <username> kvm
- Launch a command prompt
- Ensure that a physical device is connected or an emulator is running.
- To list physical devices:
$ANDROID_HOME/platform-tools/adb.exe devices
- To list created emulator devices:
$ANDROID_HOME/tools/emulator.exe -list-avds
- Create a new virtual device if there are no existing devices.
- Start an emulator:
$ANDROID_HOME/tools/emulator.exe @nameofemulator
- To list physical devices:
- Load the APK:
$ANDROID_HOME/platform-tools/adb.exe install -r path/to/apk.apk
- If multiple devices are connected you may need
$ANDROID_HOME/platform-tools/adb.exe install -r -s SERIAL path/to/apk.apk
. ReplaceSERIAL
with the device serial number listed in step 2.
- If multiple devices are connected you may need
Keyman for Android help is maintained in the Markdown files in android/help/.
The script build-help.sh
uses the pandoc
tool to convert the Markdown files into html.
./build-help.sh htm
This script is automatically called when Keyman for Android is built.
There are two included sample projects that can be modified to test a keyboard.
android/Samples/KMSample1 app runs a bare Keyman app for testing a keyboard.
android/Samples/KMSample2 app provides prompts for setting KMSample2 as a system level keyboard. Both sample apps include a default Tamil keyboard.
Building these projects follow the same steps as KMAPro:
- Build KMEA
- cd to the desired KMSample directory
./build.sh
- Open Android Studio to run the app
android/Tests/KeyboardHarness app is a test harness for developers to troubleshoot keyboards.
- Copy the keyboard js file and applicable ttf fonts to android/Tests/KeyboardHarness/app/src/main/assets/.
- In Keyman Developer
- Open the
keyboardharness.kpj
project and add your keyboard files to the keyboard package. - Build the keyboardharness.kmp keyboard package
- Add the keyboard in android/Tests/KeyboardHarness/app/src/main/java/com/keyman/android/tests/keyboardHarness/MainActivity.java
- cd to android/Tests/KeyboardHarness/
./build.sh
- Open Android Studio to run the app
- Open a terminal or Git Bash prompt and go to Keyman Engine for Android project folder (e.g.
cd ~/keyman/android/KMEA/
) - Run
./build.sh
Keyman Engine for Android library (keyman-engine.aar) is now ready to be imported in any project.
- Add keyman-engine.aar into [Your project folder]/app/libs/ folder. a. We recommend downloading the the latest stable release of Keyman Engine and extracting the .aar file. b. If you choose to use your own build of the Keyman Engine, get the library from android/Samples/KMSample1/app/libs/keyman-engine.aar
- Open your project in Android Studio.
- Open build.gradle (Module: app) in "Gradle Scripts".
- Check that the
android{}
object, includes the following:
android {
compileSdkVersion 30
// Don't compress kmp files so they can be copied via AssetManager
aaptOptions {
noCompress "kmp"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
- After the
android {}
object, include the following:
repositories {
flatDir {
dirs 'libs'
}
google()
mavenCentral()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.3.0-rc01'
implementation 'com.google.android.material:material:1.3.0'
api (name:'keyman-engine', ext:'aar')
implementation 'io.sentry:sentry-android:4.3.0'
implementation 'androidx.preference:preference:1.1.1'
// Include this if you want to have QR Codes displayed on Keyboard Info
implementation ('com.github.kenglxn.QRGen:android:2.6.0') {
transitive = true
}
}
- include
import com.tavultesoft.kmea.*;
to use Keyman Engine in a class.