Command Reference

Everything you need to orchestrate the Android SDK straight from your terminal. All commands can be prefixed with either ktroid or the alias ktd.

# Global Flags

You can append --help to any command to see inline terminal documentation. Use --verbose for detailed gradle logs.

# Offline Support

Once ktd setup has downloaded the necessary SDKs and build tools, subsequent project creation and compilation runs 100% offline.

create

Project Setup

Generates a complete Android Studio-compatible project structure with Gradle wrappers, AndroidManifest, and default Kotlin activities.

Usage
ktd create <project_name> [package_name]

Parameters

Flag / ArgTypeStatusDescription
project_namestringReqName of your app.
package_namestringOptApplication ID (e.g., com.example.app).

Examples

ktd create MyApp com.mycorp.app

init

Project Setup

Populates the current working directory with an Android project structure. Warns if the directory is not empty.

Usage
ktd init

Examples

ktd init

info

Project Setup

Parses the app/build.gradle file and prints the Application ID, version codes, and target/min SDKs.

Usage
ktd info

Examples

ktd info

build

Building & Running

Runs gradlew assembleDebug, assembleRelease, or bundleRelease. For release builds, it automatically verifies the APK signature.

Usage
ktd build [action]

Parameters

Flag / ArgTypeStatusDescription
actionstringOptBuild type. Valid options are debug, release, bundle. Default is debug.

Examples

ktd build release

run

Building & Running

Automatically builds the debug APK, asks you to select a connected device, installs the APK via ADB, and launches the MainActivity.

Usage
ktd run

Examples

ktd run

clean

Building & Running

Executes ./gradlew clean to remove previous build outputs.

Usage
ktd clean

Examples

ktd clean

signing

Building & Running

Generates a signing.properties file. If you don't have a keystore, it automatically uses keytool to generate an RSA 2048-bit release keystore.

Usage
ktd signing

Examples

ktd signing

emulator

Device & Emulator Management

Wraps avdmanager and emulator commands. list shows available AVDs. start boots the emulator in the background. create interactively builds a new AVD.

Usage
ktd emulator <action> [name]

Parameters

Flag / ArgTypeStatusDescription
actionstringReqlist, start, or create.
namestringOptName of the emulator to start.

Examples

ktd emulator start Pixel_API_35

logs

Device & Emulator Management

Reads your applicationId from build.gradle, finds the running PID on the device, and strictly filters logcat output so you only see your app's logs.

Usage
ktd logs

Examples

ktd logs

install

Device & Emulator Management

Prompts for device selection (if multiple exist) and uses adb install to push the APK to the device.

Usage
ktd install <apk_path>

Parameters

Flag / ArgTypeStatusDescription
apk_pathstringReqPath to the APK file.

Examples

ktd install app/build/outputs/apk/release/app-release.apk

uninstall

Device & Emulator Management

Uninstalls the application. If no package is provided, it reads the current project's package name from build.gradle.

Usage
ktd uninstall [package_name]

Parameters

Flag / ArgTypeStatusDescription
package_namestringOptPackage to remove.

Examples

ktd uninstall com.mycorp.app

dep

Dependency Management

Automatically injects an implementation block into your app/build.gradle. Supports shortcuts for common libraries. Leave empty to see the list of shortcuts.

Usage
ktd dep <name>

Parameters

Flag / ArgTypeStatusDescription
namestringOptDependency shortcut or full Maven coordinates.

Examples

ktd dep retrofit
ktd dep "com.google.code.gson:gson:2.10.1"

dep-list

Dependency Management

Parses and neatly lists all implementation, api, and test dependencies currently active in the project.

Usage
ktd dep-list

Examples

ktd dep-list

dep-remove

Dependency Management

Safely finds and removes the dependency line from app/build.gradle.

Usage
ktd dep-remove <dep_name>

Parameters

Flag / ArgTypeStatusDescription
dep_namestringReqString matching the dependency to remove.

Examples

ktd dep-remove retrofit

perm

Permission Management

Injects a <uses-permission> tag into the manifest. Supports shortcuts like internet, camera, location, storage. Leave empty to view shortcuts.

Usage
ktd perm <name>

Parameters

Flag / ArgTypeStatusDescription
namestringOptPermission shortcut or full string.

Examples

ktd perm internet

perm-remove

Permission Management

Removes the specified permission tag from AndroidManifest.xml.

Usage
ktd perm-remove <name>

Parameters

Flag / ArgTypeStatusDescription
namestringReqPermission string or shortcut.

Examples

ktd perm-remove camera

test

Testing

Runs ./gradlew test for local JVM tests, or connectedAndroidTest for instrumented tests on an emulator/device.

Usage
ktd test [test_type]

Parameters

Flag / ArgTypeStatusDescription
test_typestringOptunit, instrumented, or all. Default is unit.

Examples

ktd test instrumented

bump

Version & Release

Auto-increments versionCode and versionName directly inside app/build.gradle.

Usage
ktd bump [bump_type]

Parameters

Flag / ArgTypeStatusDescription
bump_typestringOptcode, name, or both. Default is both.

Examples

ktd bump both

setup

Environment Settings

Runs the Master Setup Wizard to automatically install Gradle, Android SDK, and configure Paths.

Usage
ktd setup

Examples

ktd setup

update-config

Environment Settings

Interactive configuration updater. Connects to APIs to fetch latest stable versions and verify custom inputs.

Usage
ktd update-config

Examples

ktd update-config

config

Environment Settings

Prints your current default Android ecosystem versions stored in config.json.

Usage
ktd config

Examples

ktd config

check

Environment Settings

Checks java -version, ANDROID_HOME, adb, and gradle paths to ensure your system is ready.

Usage
ktd check

Examples

ktd check

version

Environment Settings

Show CLI version.

Usage
ktd --version

Examples

ktd --version