Skip to content

A self-contained Android automation runtime that lets you generate, build, sign, and manage Android apps entirely from the CLI or JavaScript -- no Android Studio required. Built for developers who prefer precision over bloat

Notifications You must be signed in to change notification settings

x2yDevs/x2y-android-runtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

x2y-Android-Runtime: Unleashing Lean, Command-Line Android Automation

License: MIT Maintenance npm version

x2y-Android-Runtime by x2y dev tools is a powerful, self-contained Android automation runtime meticulously crafted for developers who prioritize precision, efficiency, and programmatic control over the complexities and overhead of traditional IDEs. Say goodbye to the need for Android Studio for every build, test, or deployment task.

This runtime liberates your development workflow, enabling you to generate, build, sign, and manage Android applications entirely from the Command Line Interface (CLI) or through JavaScript APIs. It provides a direct, unencumbered pathway to the real Android toolchain, putting full control at your fingertips.


Why Choose x2y-Android-Runtime?

We believe in empowering developers with tools that are powerful without being bloated. x2y-Android-Runtime is built on this philosophy, offering:

  • IDE-Free Development: Perform critical Android development tasks without opening Android Studio, perfect for lightweight scripting and server environments.
  • Full Programmatic Access: Control every stage of your app's lifecycle with robust CLI commands or integrate seamlessly into custom JavaScript pipelines.
  • Official Toolchain Reliability: Directly leverages the trusted, official Android system tools (adb, gradlew, keytool, apksigner, zipalign) ensuring compatibility, performance, and security, just like Android Studio does under the hood. No custom compilers or non-standard build processes.
  • Streamlined Automation: Designed from the ground up for integration into Continuous Integration/Continuous Deployment (CI/CD) pipelines, custom build systems, or simple automation scripts.

Core Capabilities:

With x2y-Android-Runtime, you gain comprehensive control over your Android projects:

  • Project Generation: Swiftly scaffold complete Android application projects, including Java source files, AndroidManifest.xml, and essential resources.
  • Robust Building: Compile and assemble installable APKs using the official Gradle Wrapper, ensuring standard and reliable build processes.
  • Secure Signing: Effortlessly sign your APKs using your established production keystores or automatically generate debug keystores for rapid development and testing.
  • Build Optimization: Enhance your application's performance and reduce file size with integrated zipalign optimization.
  • Device Management: Interact with connected Android devices and emulators, enabling installation, debugging, and other ADB operations.
  • End-to-End Automation: Automate the entire app build and deployment cycle, making it ideal for CI/CD environments and bespoke development workflows.

x2y-Android-Runtime is your go-to solution for agile, precise, and automated Android application development. Dive in and experience a new level of control over your Android builds.

πŸ“– Table of Contents

✨ Features

x2y-Android-Runtime provides a robust set of features for command-line and programmatic Android automation:

  • IDE-Free Workflow: Develop, build, and deploy Android apps without needing Android Studio.
  • Comprehensive Programmatic Control: Utilize CLI commands or JavaScript APIs for full lifecycle management.
  • Official Android Toolchain Integration: Leverages adb, gradlew, keytool, apksigner, and zipalign for reliability and compatibility.
  • CI/CD Ready: Designed for seamless integration into automated build and deployment pipelines.
  • Project Scaffolding: Quickly generate new Android projects with standard structure.
  • APK Building: Compile and assemble APKs using Gradle.
  • Flexible Signing: Support for both debug and production keystore signing.
  • APK Optimization: Automatic zipalign for optimized APKs.
  • Device Interaction: Manage connected devices and emulators via ADB operations.
  • End-to-End Automation: Automate the entire app build and deployment cycle.

πŸš€ Technologies Used

This project leverages the following key technologies and tools:

  • Node.js: The primary runtime environment for x2y-Android-Runtime.
  • Java Development Kit (JDK): Essential for compiling Java code and using tools like keytool.
  • Android SDK: Provides core Android development tools, including:
    • Android Build Tools: For compiling and packaging Android applications.
    • Android Platform Tools: Includes adb (Android Debug Bridge) for device interaction.
  • Gradle: The build automation system used for Android projects.
  • Official Android Toolchain:
    • gradlew (Gradle Wrapper)
    • keytool
    • apksigner
    • zipalign

βš™οΈ Requirements

To get started with x2y-Android-Runtime, ensure you have the following installed:

Tool Version Installation Guide
Node.js v18+ https://nodejs.org
JDK 17 (Temurin) 17 https://adoptium.net/temurin/releases/?version=17
Android SDK + build-tools Required - Install via Android Studio or CLI tools

After installation, confirm everything works by running:

keytool -help
adb version

πŸ“¦ Installation

Global CLI:

To install x2y-android-runtime globally and use its CLI commands:

npm install -g x2y-android-runtime

Local Project Use:

To install x2y-android-runtime as a dependency in your local project:

npm install x2y-android-runtime

πŸ› οΈ Usage

CLI Usage

x2y-android-runtime provides a powerful Command Line Interface for direct interaction.

1. List Connected Devices

x2y-android devices

Example output:

Connected devices:
emulator-5554 (device)
ABC123DEF456 (offline)

2. Build a Real APK

This command builds, signs, and optimizes an Android application.

x2y-android build \
  -p ./my-app \
  -n "My Awesome App" \
  -k ./my-release.keystore \
  -K "keystore_password" \
  -a "my-key-alias" \
  -A "key_password"

If no keystore is provided, a debug keystore is generated automatically (JDK required).

On success:

Build successful.
APK: C:\path\to\my-app\app\build\outputs\apk\debug\app-debug.apk

JavaScript Usage

Integrate x2y-android-runtime directly into your Node.js scripts for custom automation pipelines:

const { build } = require('x2y-android-runtime');

(async () => {
  try {
    const apkPath = await build.buildAndroidApp({
      projectPath: './my-app',
      appName: 'MyApp',
      keystorePath: './debug.keystore', // Optional: if omitted, debug keystore is auto-generated
      keystorePassword: 'android',
      keyAlias: 'androiddebugkey',
      keyPassword: 'android'
    });

    console.log('APK ready:', apkPath);
  } catch (err) {
    console.error('Build failed:', err.message);
  }
})();

Auto-Generated Project Structure

When you create a new project using x2y-android-runtime, it generates a standard Android project structure:

my-app/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ build.gradle
β”‚   β”œβ”€β”€ src/main/
β”‚   β”‚   β”œβ”€β”€ AndroidManifest.xml
β”‚   β”‚   β”œβ”€β”€ java/com/x2y/myapp/MainActivity.java
β”‚   β”‚   └── res/
β”œβ”€β”€ gradlew.bat
β”œβ”€β”€ gradle/
β”‚   └── wrapper/
β”‚       └── gradle-wrapper.properties
β”œβ”€β”€ build.gradle
└── settings.gradle

This structure is fully compatible with Android Studio, allowing you to seamlessly transition between command-line automation and graphical development as needed.

Signing & Security

x2y-android-runtime adheres to standard Android signing practices:

  • Debug Builds: Automatically use the default Android debug keystore for development and testing.
  • Production Builds: Require you to provide your own release keystore for secure signing.
  • Official Tooling: All signing operations are performed using the official apksigner tool, ensuring industry-standard security.

❗ Troubleshooting

Encountering issues? Here are some common problems and their solutions:

Error Fix
Build failed: Command failed Ensure Android build-tools are installed as part of your Android SDK.
Gradle wrapper not found You likely need to create an Android project first using x2y-android create or ensure you're in the correct project directory.
adb is not recognized Install Android Platform-Tools and ensure its platform-tools directory is in your system's PATH environment variable.
keytool is not recognized Install JDK 17 (or compatible) and add its bin directory to your system's PATH environment variable.

If you're still facing issues, please refer to the official Android documentation or open an issue on our GitHub repository.

🀝 Contributing

We welcome contributions to x2y-Android-Runtime! If you're interested in improving the project, please follow these guidelines:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix (git checkout -b feature/your-feature-name).
  3. Make your changes and ensure they adhere to our coding standards.
  4. Write comprehensive tests for your changes.
  5. Commit your changes with a clear and descriptive message.
  6. Push your branch to your forked repository.
  7. Open a Pull Request to the main branch of the original repository.

Please ensure your code is well-documented and your pull request description clearly explains the problem it solves or the feature it adds.

πŸ“œ License

This project is released under the MIT License – feel free to use, modify, and distribute it as you wish. See the LICENSE file for more details.

πŸ“ž Contact

For questions, feedback, or support, please reach out to:

x2y dev tools https://x2ydevs.xyz

Building powerful, open Android automation tools for developers.

About

A self-contained Android automation runtime that lets you generate, build, sign, and manage Android apps entirely from the CLI or JavaScript -- no Android Studio required. Built for developers who prefer precision over bloat

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published