Skip to content

MonkeyKing is a small Jyphon Library to enable Android simulators to automate steps in a automation script.

Notifications You must be signed in to change notification settings

mickmak-busicat/MonkeyKing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Monkey King Library

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.

How to contribute:

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

Runtime environment setup:

  1. Major setup:

    • adb command available
    • monkeyrunner available
  2. Other setup:

    • aapt build-tools available
    • Android emulator(NOX player is tested.) or Android device

Usage:

  1. Install the target APP on your Android

Get it from internet?

  1. Get your Android Environment ready

Get emulator connected using adb:

https://www.bignox.com/blog/how-to-connect-android-studio-with-nox-app-player-for-android-development-and-debug/

or Get your device connected using adb:

https://developer.android.com/studio/command-line/adb.html#Enabling

  1. 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

  1. The tool should able to start automation on the target APP(Game)

Wait patiently...

  1. 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.

Bundle structures:

About script bundles,

Configurations:

  1. 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. Locate launchable-activity and use it in config file. Example:
./aapt d badging ~/monkeyscript/apk/cf.apk

...
launchable-activity: name='jp.wonderplanet.Yggdrasil.BULL'  label='Crash Fever' icon=''
...

Script documentation:

WIKI

Pending items:

  • Library contents
  • Readme
  • Wiki for contributing
  • Example bundle for test

Support:

Welcome to leave me comment or idea in this repo.

About

MonkeyKing is a small Jyphon Library to enable Android simulators to automate steps in a automation script.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published