Monkey King Library is a simple Jython tool that make use of monkeyrunner
in Android Developer Tools to run customized automation scripts(.mks). You can write your own mks script to automate a task on your Android environment such as doing some repetitive tasks or doing App test automations. This library is mainly designed for rerolling first summons(or GACHA)(aka 刷首抽 in Chinese) in a modern mobile game. It provided some useful methods to help achieve the reroll process in a more convenient way.
Basically, I will non-regularly upload some script bundles of a few most recent&famous mobile game to bundle
folder. Feel free to get it and try. It is soooo welcome for anyone who is also interested in writing script bundle, there is a quick guide in WIKI page. Simply read it and follow the instruction. :D
-
Major setup:
adb
command availablemonkeyrunner
available
-
Other setup:
aapt
build-tools available- Android emulator(NOX player is tested.) or Android device
- Install the target APP on your Android
Get it from internet?
- Get your Android Environment ready
Get emulator connected using adb:
or Get your device connected using adb:
https://developer.android.com/studio/command-line/adb.html#Enabling
- Run the tool
Go to Android tools directory(or add it to system path), run:
./monkeyrunner {PATH TO MonkeyKing}/MonkeyMain.py {Config name}
Config name is the filename of mks config without file extension. For example, a full command:
./monkeyrunner ~/MonkeyScript/MonkeyMain.py MonsterStrikeBundle
- The tool should able to start automation on the target APP(Game)
Wait patiently...
- Finish and view the result
Depends on different script settings, the tool should be able to generate some useful results:
- Result of first summon(GACHA) in screenshot format
- Screenshot of recovery code(if the game provide this feature), it is useful for nonstop automation.
The result format will be shown inside the script bundle setting.
About script bundles,
- View APK start activity:
- To start the game with using code, you must need to know the main activity name. It can be achieved by using
aapt
tool from Android build tools. It should able to display a list of attributes of the apk. Locatelaunchable-activity
and use it in config file. Example:
- To start the game with using code, you must need to know the main activity name. It can be achieved by using
./aapt d badging ~/monkeyscript/apk/cf.apk
...
launchable-activity: name='jp.wonderplanet.Yggdrasil.BULL' label='Crash Fever' icon=''
...
WIKI
- Library contents
- Readme
- Wiki for contributing
- Example bundle for test
Welcome to leave me comment or idea in this repo.