Files
AutoJs6/.readme/README-en.md
2025-07-18 17:54:08 +08:00

46 KiB
Raw Blame History

autojs6-banner_800×224

JavaScript automation tool supporting accessibility service on the Android platform

GitHub release (latest by date) GitHub closed issues Created
Rhino Android Studio
CodeFactor Grade JetBrains supporter GitHub License


Languages


The current README.md supports the following languages:


Introduction


Auto.js is a JavaScript automation tool software for the Android platform that supports Accessibility Service.

Auto.js was first released by hyb1996 on 2017/01/27 and ceased maintenance on 2020/03/13, with the final version name being 4.1.1 Alpha2 and build number 461.

AutoJs6 is based on the final project of Auto.js, undergoing secondary development on 2021/12/01 and continues to be open-source and free.

The table below lists some Auto.js-related projects (sorted by development date):

Project App Name Developer Development Start Date Development End Date
Auto.js Auto.js hyb1996 2017/01/27 2020/03/13
Auto.js Pro 7 Auto.js hyb1996 2019/03/13 2019/07/08
Auto.js Pro 8 AutoJsPro hyb1996 2019/10/13 2021/07/24
Auto.js Auto.js M TonyJiangWJ 2019/11/21 -
AutoX Autox.js kkevsekk1 2020/07/24 -
Auto.js Pro 9 AutoJsPro hyb1996 2021/03/28 2023/02/09
AutoJs6 AutoJs6 SuperMonster003 2021/12/01 -
AutoX Autox.js v6 wilinz 2022/05/26 -
AutoX Autox.js v7 aiselp 2024/04/21 -

The dates in the table are estimated and may differ from actual dates.

Auto.js Pro 7/8/9 in the table are paid versions, and the rest are free open-source versions.


Functions


  • Can be used as a JavaScript IDE (code completion/variable renaming/code formatting)
  • Supports automation based on Accessibility Service
  • Supports floating button quick actions (script recording and running/view package name and activity/layout analysis)
  • Supports Selector API and provides control traversal/information retrieval/control operations (similar to UiAutomator)
  • Supports layout interface analysis (similar to Android Studio's LayoutInspector)
  • Supports recording functionality and playback of recorded actions
  • Supports screen capture/save screenshots/color search in images/image matching
  • Supports E4X (ECMAScript for XML) for interface writing
  • Supports packaging script files or projects into APK files
  • Supports expanded functionality using Root privileges (screen click/slide/record/Shell)
  • Supports use as a Tasker plugin
  • Supports connection with VSCode for desktop development (requires AutoJs6-VSCode-Extension plugin)

Environment


  • Android Operating System
  • API 24 (7.0) [N] and above

Manual



Major Changes


Compared to the final open-source version 4.1.1 Alpha2 of Auto.js, the main upgrades or changes in AutoJs6 are:

  • Supports obtaining ADB privileges through Shizuku and using system API
  • Supports building WebSocket instances to perform network requests based on the WebSocket protocol
  • New modules [ base64 / crypto / sqlite / i18n / notice / ocr / opencc / qrcode / shizuku / ... ]
  • Multilingual support [ Spanish / French / Russian / Arabic / Japanese / Korean / English / Simplified Chinese / Traditional Chinese / ... ]
  • Theme color adaptation [ Grouping / Location / Search / History / Automatic Adaptation of Brightness and Contrast / ... ]
  • Night mode adaptation [ Settings page / Documentation page / Layout analysis page / Floating window / ... ]
  • VSCode plugin supports both client (LAN) and server (LAN/ADB) connection methods
  • Rhino engine upgraded from v1.7.7.2 to v1.8.1-SNAPSHOT

Version Histories


v6.6.4

2025/05/31
  • Hint API change: ui.(status/navigation)BarAppearanceLight[By] -> ui.(status/navigation)BarIconLight[By]
  • Feature util.dpToPx/spToPx/pxToDp/pxToSp methods for pixel unit conversion
  • Fix Subtitles may be displayed incompletely when rotating the screen to landscape orientation
  • Fix Some page content may be obscured by the side navigation bar when rotating to landscape
  • Fix Incomplete status bar background tint area on some pages in Android 15 issue #398
  • Fix Code editor might write files with low-confidence encoding causing decoding errors (attempted fix)
  • Improvement Improved layout adaptability on the App and Developer pages and removed unnecessary layout categories
  • Improvement README.md build section added multiple methods to help locate the target settings page issue #404
  • Improvement Some dependency or local library version adjustments CHANGELOG.md

v6.6.3

2025/05/27
  • Feature Version history feature: view multi-language release changelogs and statistics
  • Feature timers.keepAlive method (now global) for keeping the script alive
  • Feature Event listeners such as engines.on('start/stop/error', callback) for global engine events
  • Feature images.detectMultiColors method for multi-point color verification issue #374
  • Feature images.matchFeatures / detectAndComputeFeatures methods: full-resolution image matching (Ref to Auto.js Pro) issue #366
  • Feature images.compressToBytes method to compress an image and generate a byte array
  • Feature images.downsample method for pixel down-sampling and creating a new ImageWrapper
  • Feature ui.keepScreenOn method to keep the device screen on while a UI page is focused
  • Feature ui.root property (getter) to obtain the "window content root container" node of the UI layout
  • Feature webview element now supports JsBridge-based web page layouts (Ref to Auto.js Pro) [see Sample Code > Layout > Interactive HTML / Vue2 + Vant (SFC)] issue #281
  • Fix Online docs in the Home > Docs tab and Docs activity may be covered by the system navigation bar
  • Fix Clicking Toolbar buttons on some pages could accidentally trigger the title click event
  • Fix Blank lines in the code editor showed box glyphs on some devices
  • Fix Color-picker dialog in the theme-color settings page could stack infinitely
  • Fix Volume-up key failed to stop all scripts when the accessibility service was disabled
  • Fix IME overlay issue when editing custom broadcast content in the Scheduled Tasks page
  • Fix Controls inside webview elements could not activate the soft keyboard properly
  • Fix APK file info dialog might fail to obtain app name and SDK info
  • Fix File-manager sample code might fail to auto-load child directory contents when entering a project folder
  • Fix Top content of UI mode on Android 15 was covered by the status bar
  • Fix Status-bar background color on some Android 15 pages could not follow the theme color dynamically
  • Fix dialogs module could not use the customView property issue #364
  • Fix Expression parameter of dialogs.input might not return the execution result
  • Fix Using JavaAdapter led to a ClassLoader stack overflow issue #376
  • Fix console.setContentTextColor caused log text color to lose its default value issue #346
  • Fix console.setContentBackgroundColor could not accept color-name arguments issue #384
  • Fix images.compress implementation corrected: now changes encoding quality instead of pixel down-sampling
  • Fix images.resize method did not work properly
  • Fix engines.all could trigger ConcurrentModificationException issue #394
  • Fix Incorrect date formats in some languages within README.md
  • Fix Gradle build could fail due to invalid library archive length issue #389
  • Improvement Layout Inspector supports hiding controls (by TonyJiangWJ) pr #371 issue #355
  • Improvement Added gradient separators to the Layout Inspector menu for lightweight grouping
  • Improvement project.json now supports a permissions option for script projects (by wirsnow) pr #391 issue #362
  • Improvement Automatically read and check declared permissions of installed apps when packaging a single file issue #362
  • Improvement Expanded theme-color adaptation scope; supports more widget types
  • Improvement Adaptive drawer width on the Home page for landscape / ultra-wide screens
  • Improvement Added horizontal and small-screen layouts for About App & Developer pages
  • Improvement Settings-page dialogs now offer a "Use default value" menu option
  • Improvement Floating Action Button in File Manager auto-hides when tapping elsewhere
  • Improvement Code formatter now supports operators such as ??, ?., ??=
  • Improvement Code editor supports reading and writing files encoded in GB18030 / UTF-16 (LE/BE) / Shift_JIS, etc.
  • Improvement Code editor supports displaying detailed file information (path/encoding/line break format/total bytes and characters, etc.) issue #395
  • Improvement Added operation-error prompts for intent actions (edit / view / install / send / play, etc.)
  • Improvement webview element's url attribute supports relative paths
  • Improvement ImageWrapper#saveTo path parameter supports relative paths
  • Improvement images.save supports PNG file-size compression when using the quality parameter issue #367
  • Improvement Clearing ignored update records and client-mode connection addresses is now supported
  • Improvement Version-update information supports multi-language display (in sync with current UI language)
  • Improvement Asynchronous loading significantly improves File Manager list scrolling smoothness
  • Improvement Improved content and formatting of script exception messages in the console
  • Improvement Sample code now supports resetting a folder to its initial contents
  • Improvement Increased efficiency when checking APK signature information
  • Improvement Optimized dialog display efficiency and information presentation for APK/media file type info
  • Improvement Gradle build script now better adapts to newer versions discussion #369
  • Improvement Some dependency or local library version adjustments CHANGELOG.md

v6.6.2

2025/04/16
  • Feature Methods such as ui.statusBarAppearanceLight, statusBarAppearanceLightBy, navigationBarColor, etc.
  • Feature ui.statusBarHeight attribute (getter) for obtaining the status bar height issue #357
  • Feature images.flip method for image flipping issue #349
  • Feature Added "file extension" option in the settings page
  • Feature New layout support in the theme color settings page (grouping, positioning, search, history, enhanced color palette, etc.)
  • Fix Issue where Android 15's status bar background color did not match the theme color
  • Fix Issue where the plugins.load method failed to properly load plugins issue #290
  • Fix Issue where the dx library could not be used properly on Android 7.x issue #293
  • Fix Potential synchronization issues in ScriptRuntime when using require to import built-in modules (tentative fix) issue #298
  • Fix Issue where the notice module was missing extension methods such as getBuilder issue #301
  • Fix Issue where methods like shizuku/shell could not accept string parameters issue #310
  • Fix Issue where the colors.pixel method could not accept single-channel image parameters issue #350
  • Fix Issue where methods such as engines.execScript/execScriptFile had abnormal default working directories when executing scripts issue #358 issue #340 issue #339
  • Fix Issue where floaty.window/floaty.rawWindow could not be executed on background threads
  • Fix Issue where floaty.getClip might not correctly retrieve clipboard content issue #341
  • Fix Issue where ui.inflate returned values were missing prototype methods such as attr/on/click
  • Fix Issue where incorrect scope context binding when using XML syntax to use a JavaScript expression as an attribute value issue #319
  • Fix Issue where exceptions in some method calls could not be caught by try..catch blocks issue #345
  • Fix Issue where generating code on the layout analysis page could cause the app to crash issue #288
  • Fix Issue where packaged applications could not properly use the shizuku module issue #227 issue #231 issue #284 issue #287 issue #304
  • Fix Issue in the code editor where jumping to the end of a line might actually move the cursor to the beginning of the next line
  • Fix Issue where rapid consecutive clicks on dialog-type items in the settings page could cause the app to crash
  • Improvement Streamlined the APK file size for the packaged application template
  • Improvement Enhanced app (and packaged apps) support for more permissions issue #338
  • Improvement Added support for the Pinyin library option on the packaging page
  • Improvement Optimized the status bar background and text color on the main activity page of packaged apps
  • Improvement Added special permission toggles (such as access all files and send notifications) to the packaged app settings page issue #354
  • Improvement Automatically switched control text and icon colors based on the brightness of the theme color
  • Improvement Improved visual experience when contrast between control theme color and background is too low
  • Improvement Enhanced HEX input control in the color palette for better compatibility when pasting color values from the clipboard
  • Improvement Set in-app navigation bar to be transparent or semi-transparent to enhance visual experience
  • Improvement Default UI mode for status bar and navigation bar set to md_grey_50 color in light mode
  • Improvement Homepage drawer's accessibility service toggle now syncs with script code
  • Improvement Homepage document page search now supports bidirectional find buttons
  • Improvement Homepage "Files" tab now supports toggling floating button visibility via long press
  • Improvement Code editor title text now supports auto-adjusting font size
  • Improvement Log page floating button visibility now linked with list scrolling actions
  • Improvement Script project configuration file project.json now supports more packaging options issue #305 issue #306
  • Improvement Improved project.json to support lenient matching of option names and alias compatibility
  • Improvement APK file type info dialog now includes file size and signature scheme information
  • Improvement APK file type info dialog now supports click listeners for copying text and navigating to app details
  • Improvement Attempted to restore com.stardust prefixed packages to improve code compatibility issue #290
  • Improvement Enhanced floaty.window/floaty.rawWindow to support execution on both main and background threads
  • Improvement Global getClip method now leverages floaty.getClip as needed to improve compatibility
  • Improvement Improved compatibility when passing null paths to files.path and related methods
  • Improvement Synchronized with the latest official upstream code of the Rhino engine and performed necessary code adaptations
  • Improvement Enhanced README.md to better document project build and run instructions issue #344
  • Improvement Some dependency or local library version adjustments CHANGELOG.md
For more version history, refer to

Project Compilation and Build


For debugging or developing the AutoJs6 open-source project, you can use Android Studio (a product of Google) or IntelliJ IDEA (a product of Jetbrains).

This section introduces the compilation and build methods of the AutoJs6 open-source project using Android Studio as an example. IntelliJ IDEA is similar.

Android Studio Preparation

Download Android Studio Narwhal | 2025.1.1 Patch 1 version (choose one as needed):

Note: The release date for the above version is Jul 10, 2025. To download other versions, or if the above link is invalid, you can visit the Android Studio release archive page.

Install or extract the above file, then run the Android Studio software (e.g., "D:\android-studio\bin\studio64.exe").

Android SDK Preparation

Note: If the Android SDK is already installed on the computer system, this section can be skipped.

Open the Android SDK (Android Software Development Kit) settings page (any of the following ways):

Help | Find action # Input "Android SDK"
[ or ]
File | Settings # Search "Android SDK"
[ or ]
File | Settings | Language & Frameworks | Android SDK
[ or ]
File | Settings | Appearance & Behavior | System Settings | Android SDK

If the Android SDK Location field is blank, click the Edit button on the right and click Next multiple times in the pop-up window.

Note: During the process, one or more relevant agreements may need to be accepted to continue.

Once the related resources are downloaded and installed, click the Finish button.
The Android SDK Location field above will auto-populate with the path, completing the SDK preparation work.

Android SDK Tools Preparation

AutoJs6 requires certain SDK tools (like NDK and CMake).

Note: If all required Android SDK Tools for AutoJs6 are already installed on the computer system, this section can be skipped.

Open the SDK Tools settings page (any of the following ways):

Help | Find action # Input "SDK Tools"
[ or ]
File | Settings # Search "SDK Tools"
[ or ]
File | Settings | Language & Frameworks | Android SDK | SDK Tools (located in the right window)
[ or ]
File | Settings | Appearance & Behavior | System Settings | Android SDK | SDK Tools (located in the right window) 

Check Show Package Details, click NDK and CMake respectively to ensure the corresponding version tools are checked, the version information of the SDK tools is located in the version.properties file in the root directory of the AutoJs6 project.

JDK Preparation

The JDK (Java Development Kit) version required for the AutoJs6 project should be at least 17, but 19 or higher is recommended.

As of Jul 18, 2025, AutoJs6 supports up to version 24 of the JDK.

Note: If the JDK is already installed on the computer system and the version meets the above requirements, this section can be skipped.

JDK can be downloaded directly via the IDE or from the Oracle website.

Open the Gradle JDK settings page (any of the following ways):

Help | Find action # Input "Gradle JDK"
[ or ]
File | Settings # Search "Gradle"
[ or ]
File | Settings | Build, Execution, Deployment | Build Tools | Gradle

Gradle JDK can be chosen or added with different versions of JDK.

If a suitable version of the JDK (>= 17) already exists in the list, it can be selected directly.
Alternatively, you can choose Download JDK to download a suitable JDK, click the Download button and wait for the download to complete.
You can also choose Add JDK to add an existing local JDK, locating its directory and completing the JDK addition.

AutoJs6 Resources Cloning

Click Get from VCS button on the main page of Android Studio.
Fill URL field with https://github.com/SuperMonster003/AutoJs6.git,
The Directory field can be modified to a specific path if needed.
Click the Clone button, wait for the AutoJs6 project resources to be cloned to the local device.

Note: The above process may require the installation of Git.

AutoJs6 Project Building

After cloning, Android Studio will open the AutoJs6 project window and automatically complete the preliminary Dependencies download and Gradle build work.

Note: The above process may take a long time. If network conditions are poor, it may need to be retried multiple times (click the Retry button).

If the build couldn't proceed automatically or you need to rebuild the project, follow these steps:

  • From the Run/Debug Configurations menu in the Toolbar, select app, which is the main AutoJs6 application
  • Click the Build Project (hammer icon) button on the left to start building the project. The default shortcut is CTRL + F9
  • Wait for the build to complete. The Builder Output tab will display a message such as "BUILD SUCCESSFUL in 1h 17m 34s"

If the build fails, you can report the error message to the AutoJs6 project's Issues page.

Note: For more details on building and running the app, please refer to Android Docs

AutoJs6 Project Deployment (Run App)

Once the project is built successfully, it can be deployed as an application (App) to a physical device (e.g., phone/tablet) or a virtual device (e.g., Android emulator).

  • In the Toolbar, select app from the Run/Debug Configurations menu, which is the main AutoJs6 application
  • In the Available Devices dropdown on the right, choose the device on which the project app should run (physical or virtual)
  • Click the Run (triangle icon) button on the right to launch the app. The default shortcut is F10
  • Wait for the deployment to finish; the chosen device will automatically install and run the project app

AutoJs6 Project Deployment (Generate APK)

Package the project and generate an APK file that can be installed on Android devices:

  • Debug Version
    • Build | Build Bundle(s) / APK(s) | Build APK(s)
    • Generate signed debug APK
    • Path example: "D:\AutoJs6\app\build\outputs\apk\debug\"
  • Release Version
    • Build | Generate Signed Bundle / APK
    • Select APK option
    • Prepare the signing file (create new or select existing), generate the signed release package
    • Path example: "D:\AutoJs6\app\release\"

Note: For more information on building an app for user release, please refer to Android Docs

Predefined Gradle Build Tasks for AutoJs6

Besides building the project App, AutoJs6 supports several predefined Gradle build tasks that help developers perform convenient project-related operations.

Under the Run/Debug Configurations menu in the Toolbar, you can find various predefined Gradle tasks, each indicated by an elephant icon on the left.

  • AutoJs6 [inrt:assemble]

Assemble the "inrt" build variant, which primarily serves the AutoJs6 script packaging feature.

The AutoJs6 project has various build variants. The "inrt" variant is used for packaging scripts, generating the template file "template.apk" required for packaging.

When using the packaging feature, you might encounter the following error message:

java.io.FileNotFoundException: template.apk

This indicates that the template file does not exist. You need to manually run the inrt:assemble task to generate the template file, then rebuild and redeploy the app.

Note: When the main project code changes and you want to synchronize these changes with the packaged app, you need to rerun the inrt:assemble task to generate the template files and redeploy the app

  • AutoJs6 [app:bundle]

Package the outputs of the debug build process, primarily for the AutoJs6 TypeScript definitions project.

After running the task, it produces the latest JAR file for the AutoJs6 project. Using the Android d.ts Generator (by NativeScript), you can generate the type definitions (d.ts format) for the main AutoJs6 app.

  • AutoJs6 [app:digest]

Append digest information to the APK produced by the release build, mainly to finalize the filename before publishing the latest version of AutoJs6 to GitHub.

Below is the comparison of filenames before and after appending the digest information:

Before:
autojs6-v6.6.2-arm64-v8a.apk
After:
autojs6-v6.6.2-arm64-v8a-0f2a9d74.apk

Reference: Android Docs


Script Development Assistance


To develop scripts that run with AutoJs6, appropriate development tools must be used:

For writing and debugging scripts on a PC, the VSCode plugin can enable PC-to-phone connectivity:

When writing code using development tools, code completion functionality can better assist developers in completing code:

When writing code, AutoJs6-related API and usage can be consulted in the documentation at any time:

Existing script development projects can serve as references and inspire creativity for personal script projects:


Contribution


Thank you to everyone who contributed to the AutoJs6 project development.

Contributors Number of Commits Recent Submissions
wirsnow 1 2025/05/19
TonyJiangWJ 5 2025/04/24
luckyloogn 3 2025/01/01
kvii 1 2024/10/16
chenguangming (Tom) 2 2024/05/14
LZX284 (AI) 17 2023/11/19
littlealei (抠脚本人) 12 2023/07/12
aiselp 6 2023/06/14
LYS86 (Lin) 2 2023/06/03

Data updated on May 27, 2025.

Data entries sorted in descending order by recent submissions.

Newly initiated, unprocessed Pull Requests will be included in the data statistics after merging.

Some contributors do not appear correctly in the GitHub Contributors due to empty contribution records, but their contribution records can still be viewed via Pull Request.