Discord here: https://discord.gg/5Yv4kqjAbm
This Android application written in Kotlin is designed to fully automate a run of Uma Musume Pretty Derby by offering a set of options to customize what event rewards the bot should prioritise, stats to focus on, etc. Building on top of the work done for , this aims to solve the issue of spending too much hands-on time with completing a run for Uma Musume Pretty Derby.
Preview.07-13-2021.mp4
This project is purely for educational purposes to learn about Android automation and computer vision - basically a fun way to practice coding skills. Any usage is at your own risk. No one will be responsible for anything that happens to you or your own account except for yourself.
- Android Device or Emulator (Nougat 7.0+)
- For the best performance and stability on phones, the device needs to be at 1080p display resolution. The speed is also best at 1080p and for other resolutions, it becomes dependent on the manual scale that you can set in the settings. Right now it defaults to 1.0 which uses 1080p as the baseline. You can determine what scales may be good for you with the template match test that you can enable in the settings as well.
- If you change the display resolution while the overlay button is still active, you will need to restart the app in order for the display changes to persist to the
MediaProjection
service.
- If you change the display resolution while the overlay button is still active, you will need to restart the app in order for the display changes to persist to the
- Tested emulator was on Bluestacks 5 (Pie 64-bit). The following setup is required:
- Portrait Mode needs to be forced on always.
- Bluestacks itself needs to be updated to the latest version to avoid Uma Musume crashing.
- In the Bluestacks Settings > Phone, the predefined profile needs to be set to a modern high-end phone like the Samsung Galaxy S22.
- Device setup:
- 4 CPU Cores
- 4GB Memory
- Display resolution set to Portrait 1080 x 1920
- Pixel density 240 DPI (Medium)
- For the best performance and stability on phones, the device needs to be at 1080p display resolution. The speed is also best at 1080p and for other resolutions, it becomes dependent on the manual scale that you can set in the settings. Right now it defaults to 1.0 which uses 1080p as the baseline. You can determine what scales may be good for you with the template match test that you can enable in the settings as well.
- Able to complete a run from start/midway to its completion.
- Settings to customize preferences and stat prioritization for Training Events.
- Handles races, both via skipping and running the race manually.
- Runs extra races to farm fans when enabled in the settings.
- A multitude of settings to configure including setting preferred stat targets per distance.
- Download the .apk file from the
Releases
section on the right and install it on your Android device. - Once you have it running, fill out the required section marked with * in the Settings page of the application. That would be the selection of the Character under the Training Event section.
- Now go back to the Home page after you have finished customizing the settings. The settings you have selected will be shown to you in the text box below the
Start
button. - Now tap on the
Start
button. If this is the first time, it will ask you to give the applicationOverlay
permission and starting up theAccessibility
service.- You are also required to enable
Allow restricted settings
in theApp Info
page of the app in the Android Settings.
- You are also required to enable
- Once it is enabled, tapping on the
Start
button again will create a popup asking if you wantMediaProjection
to work onA single app
orEntire screen
. Select theEntire screen
option. A floating overlay button will now appear that you can move around the screen. - Navigate yourself to the screen below that shows available options like Rest, Train, Buy Skills, Races, etc.
- Press the overlay button to start the automation process. For enabling app notifications, it is recommended to have a notification style that is small enough that it does not fully cover the top part of the screen where it contains the date, energy, turn number, etc. Or disable notifications if you do not want to worry about it.
- The bot will not start on any other screen than what is shown above.
- Install
Android Studio
and create any new project or open an existing one in order for theLogcat
console to appear at the bottom. - Connect your Android device to your computer:
- USB Connection: Enable
Developer Options
andUSB Debugging
on your device, then connect via USB cable. - Wireless Connection: In Developer Options, enable
Wireless debugging
and pair your device using the pairing code or QR code. - Bluestacks or other emulators In the emulator settings, there is usually an option to open up to allow ADB wireless connection on
127.0.0.1:5555
. Enabling that option should be enough but if Android Studio still does not see it, you can open up a terminal likecmd
and typeadb connect 127.0.0.1:5555
and it should sayconnected to 127.0.0.1:5555
. You may need to typeadb disconnect
to disconnect all ADB connections beforehand for a fresh slate.
- USB Connection: Enable
- In Android Studio's Logcat console at the bottom of the window, select your connected device from the device dropdown menu.
- Filter the logs by typing
package:com.steve1316.uma_android_automation [UAA]
or just[UAA]
in the search box to see only the logs from this app. - Run the app - you'll now see all of its logs appear in real-time as it runs.
NOTE: this only works when downscaling. If your device official resolution is lower than 1080p it will most likely not work.
-
Install the aShell You app. This allows you to run adb commands locally on your Android device, but requires Shizuku.
-
Install Shizuku, then start it by following these instructions.
-
With Shizuku started, you can then use aShell You to send the following adb commands:
- Change resolution to 1080p:
wm size 1080x1920 && wm density 240
- Revert changes:
wm size reset && wm density reset
You can also bookmark the commands for your own convenience.
- Change resolution to 1080p:
Alternatively, you can do the same on a computer if you cannot get the above to work out.
- Install adb. You will also to add the file path to the folder to
PATH
via theEnvironment Variable
setting underView advanced system settings
so that the terminal will know what theadb
command should do. You may need to restart your computer to have your terminal pick up the changes. - Open up a new terminal anywhere (cmd, Powershell, etc).
- Plug in your Android device via USB. If all goes well, then executing
adb devices
will show your connected device whenSettings > Developer options > USB Debugging
is enabled. There may be a popup on your Android device beforehand asking you to give permission to connect to ADB. Wirelessly connecting to ADB is also available via the AndroidSettings > Developer options > Wireless debugging
- Execute the following commands individually to forcibly set your display resolution to 1080p and DPI to 240:
- Change resolution to 1080p:
adb shell wm size 1080x1920
andadb shell wm density 240
- Revert changes:
adb shell wm size reset
andadb shell wm density reset
- Change resolution to 1080p:
Note: If your home button disappears, reset the DPI back to default.
Make sure to use 1.0 scaling, as well as 80% confidence for best results in 1080p.
- Download and extract the project repository.
- Go to
https://opencv.org/releases/
and download OpenCV (make sure to download the Android version of OpenCV) and extract it. As of 2025-07-20, the OpenCV version used in this project is 4.12.0. - Create a new folder inside the root of the project repository named
opencv
and copy the extracted files in/OpenCV-android-sdk/sdk/
from Step 2 into it. - Open the project repository in
Android Studio
. - Open up the
opencv
module'sbuild.gradle
. At the end of the file, paste the following JVM Toolchain block:
// Explicitly set Kotlin JVM toolchain to Java 17 to match the OpenCV module's Java target.
// Without this, Kotlin defaults to JVM 21 (especially with Kotlin 2.x), which causes a build failure:
// "Inconsistent JVM Target Compatibility Between Java and Kotlin Tasks".
// See: https://kotl.in/gradle/jvm/toolchain for details.
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
- You can now build and run on your Android Device or build your own .apk file.
- You can set
universalApk
totrue
in the app'sbuild.gradle
to build a one-for-all .apk file or adjust theinclude 'arm64-v8a'
to customize which ABI to build the .apk file for.
- jpn.traineddata from UmaUmaCruise by @amate
- eng.traineddata from tessdata
- MediaProjection - Used to obtain full screenshots
- AccessibilityService - Used to dispatch gestures like tapping and scrolling
- OpenCV Android - Used to template match
- Tesseract4Android - For performing OCR on the screen
- string-similarity - For comparing string similarities during text detection
- AppUpdater - For automatically checking and notifying the user for new app updates