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 comprehensive set of options to customize event rewards, stat prioritization, race scheduling, automatic skill point buying, and more. Featuring a robust modern frontend built on React Native (Expo) and an extensive computer-vision driven backend, this app aims to solve the issue of spending too much hands-on time completing runs into something you can set and forget.
Preview-2026-02-21.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+)
- Hard requirement for Android phones is 1080p and 240 DPI or 450 DPI (for Samsung phones). If your device do not meet these, you can try the
Basic Template Matching Testin the Settings under theDebug Testssection to determine the best scale to use in theCustom Scale for Template Matchingsetting. If not, then you can also try the To set the phone's resolution to 1080p (faster and more accurate) section to forcibly set the display resolution and DPI of your Android phone. Note that may come with the side-effect of your device UI being scrunched in or zoomed out.- Note: 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
MediaProjectionservice.
- Note: 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 emulators are Bluestacks 5 (Pie 64-bit, but other versions should work) and MuMu. 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.
- Setup for both BlueStacks and MuMu:
- 4 CPU Cores
- 4GB Memory
- 1080 x 1920 (width x height)
- 240 DPI (This is important)
- Hard requirement for Android phones is 1080p and 240 DPI or 450 DPI (for Samsung phones). If your device do not meet these, you can try the
- The in-game graphics need to be set to
Standardinstead ofBasic.
- Completes a full run from start/midway to its conclusion.
- Supports multiple scenarios including URA Finale, Unity Cup, and those in the future to come.
- Advanced OpenCV template matching for real-time gamestate awareness.
- YOLOv8-powered real-time stat gain detection for improved accuracy.
- Tesseract OCR integrated with rapid fuzzy string matching.
- Modern user interface built using React Native, Typescript and Expo for full configurability.
- Remote Log Viewer to monitor real-time automation progress from any browser on the same network.
- Screen recording for debugging to easily capture and review issues.
- Import/export settings as JSON, alongside customizable skill point buying plans and training configurations.
- Smart racing plan that dynamically schedules extra races based on current stats and fan requirements.
- Training Event customization per event for fine-grained control over choices.
- Load and manage profiles for the Training Settings to easily swap between different builds.
- A multitude of settings to configure including setting preferred stat targets per distance.
- Download the latest
.apkfile from theReleasessection on the right of this page and install it on your Android device. - Open the application. Upon launching, navigate through the user-friendly frontend to select your desired scenario (URA Finale, Unity Cup, etc.) and configure your training priorities, races, and other settings.
- You can review your loaded settings and configurations directly on the Home page.
- Tap the
Startbutton. If this is the first time, you will be prompted to grantOverlaypermissions and enable theAccessibilityservice.- On newer Android versions, you're required to enable
Allow restricted settingsin the app'sApp Infosettings.
- On newer Android versions, you're required to enable
- Once enabled, tapping
Startwill requestMediaProjectionaccess (selectEntire screenif prompted). A floating overlay button will appear that you can drag around the screen. - IMPORTANT: Follow the guidance overlay when you drag the overlay button for the places on the screen to safely leave the button at to avoid covering important UI elements.
- Navigate to the main training menu in Uma Musume (where Rest, Train, Buy Skills, Races, etc. are visible).
- Tap the overlay button to start automation. (Tip: Use minimal or deactivated notifications to prevent interference with OCR scanning the top of the screen).
- Install
Android Studioand create any new project or open an existing one in order for theLogcatconsole to appear at the bottom. - Connect your Android device to your computer:
- USB Connection: Enable
Developer OptionsandUSB Debuggingon your device, then connect via USB cable. - Wireless Connection: In Developer Options, enable
Wireless debuggingand 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 likecmdand typeadb connect 127.0.0.1:5555and it should sayconnected to 127.0.0.1:5555. You may need to typeadb disconnectto 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 to original:
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
PATHvia theEnvironment Variablesetting underView advanced system settingsso that the terminal will know what theadbcommand 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 deviceswill show your connected device whenSettings > Developer options > USB Debuggingis 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 1080x1920andadb shell wm density 240 - Revert changes:
adb shell wm size resetandadb 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, and an 80% confidence threshold for best results in 1080p natively.
This project is separated into a React Native frontend configured via Expo and an extensive Kotlin/OpenCV backend.
- Download and extract the repository.
- Download OpenCV for Android (v4.12.0) from
https://opencv.org/releases/. Create/android/opencvand copy the extracted/OpenCV-android-sdk/sdk/contents into it. - IMPORTANT: The project uses a YOLOv8 model for stat gain detection. Ensure the
best.onnxmodel file is present in theandroid/app/src/main/assets/directory. - The project utilizes Expo. Run
yarn installfrom the root directory to install frontend dependencies. - The dev environment is ready. Run
yarn startornpx expo startto run the Metro HTTP server. - To ensure code consistency, developers should format and lint the codebase using the following commands:
yarn format: Formats TypeScript and TSX files using Prettier.yarn format:kt: Formats Kotlin files using Ktlint (following settings in android/.editorconfig).
- To test Android builds, execute
yarn androidto compile and install the application directly on your device. Useyarn buildfor release APK generation. - Note: Do not run the React Native shell app directly from Android Studio. Always rely on the Expo Metro bundler for correct bridging.
- 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
- React Native - Used as the frontend
- Expo - Modern modular frontend
- SQLite - Local database via expo-sqlite
- Ktor - For the Remote Log Viewer
- YOLOv8 - Object detection
- ONNX Runtime - Lightweight engine for executing the YOLOv8 model
