46 KiB
Languages
The current README.md supports the following languages:
- 简体中文 [zh-Hans]
- 繁體中文 (香港) [zh-Hant-HK]
- 繁體中文 (台灣) [zh-Hant-TW]
- English [en] # current
- Français [fr]
- Español [es]
- 日本語 [ja]
- 한국어 [ko]
- Русский [ru]
- العربية [ar]
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
Manual
- Application Documentation
- User Manual (to be written)
- Troubleshooting
- Project Compilation and Build
- Script Development Assistance
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 / ... ]
- 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
- Unicode code point escape support for supplementary plane characters
'\u{1D160}'; /* stands for "𝅘𝅥𝅮", traditional method: '\uD834\uDD60'. */ - Supports Object.values()
Object.values({name: 'Max', age: 4}); // ['max', 4] - Supports Array.prototype.includes()
[10, 20, NaN].includes(20); // true - Supports BigInt
typeof 567n === 'bigint'; // true - Supports template strings
`Lucky number: ${(Math.random() * 100).toFixed(0)}` - View more new features of the Rhino engine here
- View Rhino engine compatibility list
- Unicode code point escape support for supplementary plane characters
Version Histories
v6.6.1
2025/01/01
FeaturePinyin module for Chinese Pinyin conversion (Refer to Project Documentation > Chinese Pinyin)FeaturePinyin4j module for Chinese Pinyin conversion (Refer to Project Documentation > Chinese Pinyin)FeatureMethods UiObject#isSimilar and UiObjectCollection#isSimilar for determining whether a control or a collection of controls is similarFeatureGlobal method "currentComponent", used to obtain the name information of the currently active componentFixIssue where the project could not compile properly in certain environments due to a rollback to an earlier versionFix"Non-primitive value" exception that may occur when calling non-existent methodsFixIssue where script shortcuts could not be added properly on certain devices (tentative fix)issue #221FixIncorrect parameter type restrictions for the automator.click/longClick methodsissue #275FixIssue where selectors did not support ConsString type parametersissue #277FixMissing methods and properties on UiObjectCollection instancesImprovementThe packaging page supports signature configuration, keystore management, and permission settings (by luckyloogn)pr #286ImprovementImproved accuracy in identifying the current package name and activity name of the floating window (Priority: Shizuku > Root > A11Y)ImprovementImproved accuracy in recognizingcurrentPackageandcurrentActivity(Priority: Shizuku > Root > A11Y)ImprovementRestore the ability to select text content of individual entries in the log activity window via double-click or long pressissue #280ImprovementRecover as much critical information as possible for script projects when project.json is corruptedImprovementAutomatically convert Simplified Chinese to Pinyin (including multi-tone characters) for generated package name suffixes when packaging single filesImprovementSupport for negative arguments in the UiSelector#findOnce and UiSelector#find methodsImprovementEnhanced adaptability of app.startActivity/startDualActivity methodsImprovementUI elements and className-related selectors now support more package name prefix omission forms (e.g., RecyclerView, Snackbar, etc.)ImprovementSynchronize with the latest upstream code of the Rhino engine and adapt it to the existing projectImprovementSome dependency or local library version adjustmentsCHANGELOG.md
v6.6.0
2024/12/02 - Built-in module rewrite, upgrade cautiously
HintThe built-in modules are rewritten in Kotlin to enhance script execution efficiency, but iterative improvements are needed.HintThe built-in init.js file is empty by default, allowing developers to extend built-in modules or mount external modules.FeatureAxios module / Cheerio module (Ref to AutoX)FeatureSQLite module for simple operations on SQLite databases (Ref to Auto.js Pro) (See project documentation > SQLite)FeatureMIME module for processing and parsing MIME type strings (See project documentation > MIME)FeatureNanoid module for string ID generation (Ref to ai/nanoid)FeatureSysprops module for obtaining runtime environment configuration data (See project documentation > System Properties)FeatureOCR module supports Rapid OCR engineFeatureLayout analysis supports window switching (Ref to Auto.js Pro)Featureauto.clearCache method supports clearing control caches (Ref to Auto.js Pro)Featurethreads.pool method supports simple application of thread pools (Ref to Auto.js Pro)Featureimages.matchTemplate method adds useTransparentMask option parameter to support transparent image search (Ref to Auto.js Pro)Featureimages.requestScreenCaptureAsync method for asynchronously requesting screenshot permissions in UI mode (Ref to Auto.js Pro)Featureimages.requestScreenCapture method adds isAsync option parameter to support asynchronous screenshot capture (Ref to Auto.js Pro)Featureimages.on('screen_capture', callback) and other event listener methods support listening for screen capture availability events (Ref to Auto.js Pro)Featureimages.stopScreenCapture method supports actively releasing resources related to screenshot applications (Ref to Auto.js Pro)FeatureImages.psnr/mse/ssim/mssim/hist/ncc and images.getSimilarity methods for obtaining image similarity metricsFeatureimages.isGrayscale method for determining whether an image is grayscaleFeatureimages.invert method for negative image conversionFeatures13n.point/time methods for standardizing point objects and duration objects (See project documentation > Normalization)Featureconsole module's gravity, touchThrough, backgroundTint methods (See project documentation > Console)FeatureMathx.randomInt/Mathx.randomFloat methods for returning random integers or random floating-point numbers within a specified rangeFeatureapp.launchDual/startDualActivity methods for handling dual app launch (Requires Shizuku or Root permissions) (Experimental)Featureapp.kill method for forcefully stopping an app (Requires Shizuku or Root permissions)Featurefloaty.getClip method for indirectly obtaining clipboard content using a floating windowFixMemory leak in View Binding of Fragment subclasses (e.g., DrawerFragment / ExplorerFragment)FixInstance memory leak in classes such as ScreenCapture / ThemeColorPreferenceFixIssue causing app crash when requesting screenshot permissions on Android 14 (by chenguangming)pr #242FixIssue causing app crash when starting foreground service on Android 14FixIssue with run button in code editor not lighting up properly on Android 14FixApp may not run properly after packaging due to missing necessary library filesissue #202issue #223pr #264FixApp crash when editing project due to missing specified icon resourcesissue #203FixUnable to use parameters properly to obtain screenshot resources of specified screen orientation when requesting screenshot permissionsFixIssue with some devices unable to add script shortcuts properly (Trial fix)issue #221FixCumulative request sending delay issue with methods related to sending requests in http moduleissue #192FixShizuku service may not work properly before AutoJs6 enters the main activity page (Trial fix)issue #255Fixrandom(min, max) method may have out-of-bounds resultsFixIssue where result type parameter of pickup methods cannot be properly passed empty arraysFixIssue where control rectangle obtained by UiObject#bounds() may be inadvertently modified, breaking its immutabilityFixIssue with text/button/input elements where text containing half-width double quotes cannot be parsed properlyFixIssue with text/textswitcher elements where autoLink attribute functionality failsFixIssue with different scripts erroneously sharing the same ScriptRuntime objectFixIssue with global variables HEIGHT and WIDTH losing dynamically-generated Getter propertiesFixIssue with potential high-latency startup caused by RootShell loading on script startupFixIssue with floating console window background color setting leading to loss of rectangular rounding styleFixAccess service auto-start may encounter abnormal service issues (Trial fix)FixIssue with triggering ViewPager switch when swiping left or right on WebView control on homepage document pageFixIssue with file manager unable to recognize file extensions containing uppercase lettersFixFile manager may not automatically recognize project when first entering project directoryFixIssue with file manager page unable to refresh automatically after deleting folderFixIssue with file manager sorting files and folders where ASCII initial letter names are put backFixFAILED ASSERTION exception in code editor debug functionFixIssue with unable to debug again properly after closing editor during code editor debug processFixIssue with potentially omitting end characters when jumping to line end in code editorFixIssue with flickering screen when starting log activity page on main activity pageFixIssue with packaged app unable to use opencc module properlyImprovementClick prompt experience for 'Unavailable ABI' control on package pageImprovementSupports using Shizuku to control 'Pointer Location' display switchImprovementSupports using Shizuku to control 'Projection Media' and 'Modify Secure Settings' permission switchesImprovementAutomator.gestureAsync/gesturesAsync supports callback function parametersImprovementtasks module uses synchronous way for database operations to avoid potential data access inconsistenciesImprovementScript execution mode supports pipeline symbol separation mode parameters (e.g., starting with"ui|auto";)ImprovementScript execution mode supports single quotes and backticks and allows omitting semicolons (e.g., starting with'ui';or'ui')ImprovementScript execution mode supports quick import of built-in extension modules such as axios, cheerio, and dayjs (e.g., starting with"axios";)ImprovementScript execution mode supports x or jsox mode parameters for quick enabling of JavaScript built-in object extension modules (e.g., starting with"x";)Improvementimg element src and path attributes support local relative paths (e.g.,<img src="a.png"/>)ImprovementCode editor supports intelligently determining insertion location when importing Java classes and package namesImprovementimages module supports using paths directly as image parametersImprovementimportPackage supports string parametersImprovementServer mode IP address supports clipboard import with intelligent recognition and smart conversion with space keyImprovementFile manager supports default prefix selection when creating new files and automatically generates appropriate numeric suffixImprovementFile manager specifically informs on exception message when running projectissue #268ImprovementFile manager supports more types and displays corresponding icon symbols (supports over 800 file types)ImprovementEditable file types (jpg/doc/pdf, etc.) in file manager have added edit buttonsImprovementAPK files in file manager support viewing basic information, Manifest information, and permissions listImprovementAudio/video media files in file manager support viewing basic information and MediaInfo informationImprovementPackage single file support auto-fill appropriate standardized package name and invalid character filter promptImprovementPackage single file support automatically sets icon and auto-increments version number and version name based on installed same package name applicationImprovementPackage configuration file supports abis/libs option to specify default included ABI architecture and librariesImprovementSupport relevant message prompts when abis/libs options of package configuration file are invalid or unavailableImprovementLeakCanary is excluded from official release version to avoid unnecessary growthImprovementAll English comments in project source code are accompanied by Simplified Chinese translations to enhance readabilityImprovementREADME and CHANGELOG support multi-language (Automatically generated by script)ImprovementEnhance Gradle build script's version adaptabilityImprovementSome dependency or local library version adjustmentsCHANGELOG.md
v6.5.0
2023/12/02
Featureopencc module (Refer to Project Documentation > Chinese Conversion) (Ref to LZX284)FeatureUiSelector adds plus and append methodsissue #115FeaturePackaging application page adds support for filtering ABIs and libraries (Ref to AutoX)issue #189FixAbnormally large file size issue in packaged applications (Ref to AutoX / LZX284)issue #176FixIssue where packaged applications cannot display and print some exception messagesFixIssue where selecting application icon on packaging application page might show empty iconFixContext not initialized exception when packaging application includes MLKit Google OCR libraryFixocr.mlkit/ocr.recognizeText/detect methods not workingFixMismatch between displayed language and application setting language for some texts (such as log page)FixText overflow issue in home page drawer switch items for some languagesFixIssue where accessibility service automatically closes immediately after being enabled on some devices without any prompt messagesissue #181FixIssue where enabling accessibility service on some devices might cause application crash due to physical keys (attempted fix)issue #183issue #186FixIssue with pickup functionality after restarting accessibility service using auto(true) (attempted fix)issue #184FixIssue where creating floating window in floaty module might cause application crash when dragging (attempted fix)FixIssue where app.startActivity cannot use shorthand parametersissue #182issue #188FixIssue where code throws exception when imported class name conflicts with global variable using importClassissue #185FixIssue where accessibility service cannot be used on Android 7.xFixIssue where runtime.loadJar/loadDex methods might not work properly on Android 14 (attempted fix)FixIssue where 'Layout Bounds Analysis' and 'Layout Hierarchy Analysis' are unavailable in Android system quick settings panelissue #193FixIssue where auto-update check might cause application ANR (attempted fix)issue #186FixIssue where file manager cannot return to workspace path page after clicking 'Up' button in example code folderissue #129FixIssue where replace button is not shown when using replace function in code editorFixIssue where long-press delete in code editor might cause application crash (attempted fix)FixIssue where fx button in code editor cannot show module function quick panelFixIssue where module function quick panel button function name might overflow in code editorImprovementThe code editor module's quick function panel adapts to night mode.ImprovementThe startup page of the packaged application is adapted to night mode, and the layout of application icons is adjusted.ImprovementThe packaged application page supports cursor navigation using the ENTER key on the software keyboard.ImprovementThe packaged application page supports toggling select-all state by clicking on ABI and library titles.ImprovementThe default ABI selection is made intelligent on the packaged application page with added guide prompts for unselectable items.ImprovementThe file manager adjusts the display of menu items based on the type and characteristics of files and folders.ImprovementThe file manager's folder right-click menu adds a packaging application option.ImprovementWhen accessibility services are enabled but malfunction, an abnormal state is reflected in the drawer switch of the AutoJs6 homepage.ImprovementThe console includes detailed stack information when printing error messages.ImprovementSome dependency or local library version adjustmentsCHANGELOG.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 Ladybug Feature Drop | 2024.2.2 version (choose one as needed):
- android-studio-2024.2.2.13-windows.exe (1.14 GB)
- android-studio-2024.2.2.13-windows.zip (1.15 GB)
Note: The release date for the above version is Jan 9 , 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.
Use CTRL + ALT + S in Android Studio to open the settings page:
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.
Use CTRL + ALT + S in Android Studio to open the settings page:
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 Mar 3 , 2025, AutoJs6 supports up to version 23 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.
Use CTRL + ALT + S in Android Studio to open the settings page:
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).
Upon completion of the build, the Build tab in Android Studio will show a message similar to BUILD SUCCESSFUL in 1h 17m 34s.
Package the project and generate an APK file that can be installed on an Android device:
- 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
APKoption - Prepare the signing file (create new or select existing), generate the signed release package
- Path example:
"D:\AutoJs6\app\release\"
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:
- AutoJs6-VSCode-Extension - AutoJs6 debugger (VSCode platform plugin)
When writing code using development tools, code completion functionality can better assist developers in completing code:
- AutoJs6-TypeScript-Declarations - AutoJs6 declaration files (code completion)
When writing code, AutoJs6-related API and usage can be consulted in the documentation at any time:
- AutoJs6-Documentation - AutoJs6 application documentation
Existing script development projects can serve as references and inspire creativity for personal script projects:
- Ant-Forest - Ant Forest energy auto-collect script by TonyJiangWJ
- Ant-Forest - Ant Forest energy auto-collect script by SuperMonster003
- autojs - Auto.js utility scripts by e1399579
- autojsDemo - Auto.js demonstration example by snailuncle
- autojs related repositories - All repositories related to the autojs topic on GitHub
Contribution
Thank you to everyone who contributed to the AutoJs6 project development.
| Contributors | Number of Commits | Recent Submissions |
|---|---|---|
| luckyloogn | 3 | 2025/01/01 |
| kvii | 1 | 2024/10/16 |
| chenguangming | 2 | 2024/05/14 |
| LZX284 | 17 | 2023/11/19 |
| TonyJiangWJ | 4 | 2023/10/31 |
| little‑alei | 12 | 2023/07/12 |
| aiselp | 6 | 2023/06/14 |
| LYS86 | 2 | 2023/06/03 |
Data updated on Jan 1 , 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.
