Member-only story

Creating an Android game bot with OpenCV and UiAutomator2 for AliExpress Merge Boss

Chelaru Adrian
5 min readDec 15, 2023

--

Are you tired to keep swiping in order to merge items in the AliExpress Merge Boss? Then it’s time to automate the process with a bot created with the OpenCV, Python, ADB and UiAutomator2 libraries.

Update: The new version doesn’t require UiAutomator2, and can be configured directly on the phone using Termux GUI interface.

You can find the bot script at the bottom of the article, including the file that explains how you can run it on both PC and Termux Android.

Merge Boss automatic merge example in left, and automatic generator item creation, merge, stop at low energy on middle, automatic energy farm at right

New version

You can find the link to the GitHub Git at the bottom of the article.

The updated version is easy to set up, so it would take you only a few minutes to make it work on your device and have some new features, like automatic deliver requirements.

I still let this article and older Gist, because it contains the OpenCV read image through web streaming from Android, multiple types of edge extraction and integration with UiAutomator2, which is relevant for some types of applications.

Purpose

The bot should be capable to match the identical items in order to create a new merge action, next when there’s no match found anymore, generate new items. When energy left is insufficient, start an action to farm energy by doing the 15-second products view from tasks. Now that’s clear what the bot should do, it’s time to implement the functions.

Implementation

Image processing

First, let’s identify a way to match the items that are alike. I’ve tried multiple ways, and the winning combination start by extracting the edges of the object. While there are some others methods, like feature extraction or histogram comparison, they are quite heavy in computing and doesn’t really provide an advantage in this case.

--

--

Chelaru Adrian
Chelaru Adrian

Written by Chelaru Adrian

💻 Hey, I'm here to share my passion for tech! 🚩 Follow me on Medium for exciting new ideas and innovative solutions.

No responses yet

Write a response