or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

asset-management.mdcli-commands.mdconfiguration.mdindex.mdplatform-operations.mdplugin-management.mdvalidation.md
tile.json

platform-operations.mddocs/

Platform Operations

Capacitor CLI provides comprehensive cross-platform operations for adding, building, and managing iOS and Android projects through command-line interfaces. Platform-specific operations are handled internally and are not exposed as exportable functions.

Capabilities

Platform Management Commands

Add Platform

Add native platform projects to a Capacitor app.

Command:

npx cap add [platform]

Options:

  • --packagemanager <packageManager> - Package manager for dependency installs (CocoaPods or SPM for iOS)

Examples:

# Add iOS platform
npx cap add ios

# Add Android platform
npx cap add android

# Add iOS with Swift Package Manager
npx cap add ios --packagemanager SPM

Update Platform

Update native plugins and dependencies based on package.json.

Command:

npx cap update [platform]

Options:

  • --deployment - Use deployment option for pod install (iOS)

Examples:

# Update all platforms
npx cap update

# Update specific platform
npx cap update ios

# Update with deployment flag
npx cap update ios --deployment

Build Operations

Build Platform

Build the release version of the selected platform.

Command:

npx cap build <platform>

Platform-specific Options:

iOS Build Options:

  • --scheme <schemeToBuild> - iOS Scheme to build
  • --configuration <name> - Configuration name of the iOS Scheme
  • --xcode-team-id <xcodeTeamID> - Developer team for building and exporting
  • --xcode-export-method <method> - Export method (app-store-connect, release-testing, etc.)
  • --xcode-signing-style <style> - Signing style (automatic or manual)
  • --xcode-signing-certificate <cert> - Certificate name or SHA-1 hash
  • --xcode-provisioning-profile <profile> - Provisioning profile name or UUID

Android Build Options:

  • --flavor <flavorToBuild> - Android Flavor to build
  • --keystorepath <keystorePath> - Path to the keystore
  • --keystorepass <keystorePass> - Password to the keystore
  • --keystorealias <keystoreAlias> - Key Alias in the keystore
  • --keystorealiaspass <keystoreAliasPass> - Password for the Key Alias
  • --androidreleasetype <type> - Release type: APK or AAB
  • --signing-type <signingtype> - Program used to sign apps (apksigner or jarsigner)

Examples:

# Build Android APK
npx cap build android --androidreleasetype APK

# Build iOS with specific scheme and configuration
npx cap build ios --scheme MyAppScheme --configuration Release

# Build Android with keystore signing
npx cap build android \
  --keystorepath /path/to/keystore.jks \
  --keystorepass mypassword \
  --keystorealias myalias \
  --keystorealiaspass aliaspassword

Run Operations

Run on Device/Emulator

Run sync, then build and deploy the native app on device or emulator.

Command:

npx cap run [platform]

Options:

  • --scheme <schemeName> - Set the scheme of the iOS project
  • --flavor <flavorName> - Set the flavor of the Android project
  • --list - List available targets, then quit
  • --target <id> - Use a specific target
  • --no-sync - Do not run sync before building
  • --forwardPorts <port:port> - Automatically run "adb reverse" for live-reloading (Android)
  • -l, --live-reload - Enable Live Reload
  • --host <host> - Host used for live reload
  • --port <port> - Port used for live reload
  • --configuration <name> - Configuration name of the iOS Scheme

Examples:

# Run on iOS device with live reload
npx cap run ios --live-reload --host 192.168.1.100

# List available Android targets
npx cap run android --list

# Run on specific iOS simulator
npx cap run ios --target "iPhone 15 Pro"

# Run Android with specific flavor
npx cap run android --flavor debug

Development Tools

Open Native IDE

Open the native project workspace in the appropriate IDE.

Command:

npx cap open [platform]

Examples:

# Open iOS project in Xcode
npx cap open ios

# Open Android project in Android Studio
npx cap open android

Platform-Specific Notes

iOS Platform

  • Requires macOS with Xcode installed
  • Uses CocoaPods by default, but supports Swift Package Manager (SPM)
  • Supports multiple schemes and configurations
  • Code signing options available for distribution builds

Android Platform

  • Requires Android SDK and either Android Studio or command-line tools
  • Supports flavors for different build variants
  • Multiple signing options (APK vs AAB, apksigner vs jarsigner)
  • Gradle-based build system

Internal Architecture

Platform operations are implemented through internal modules that are not exported from the CLI package:

  • Android operations are handled by /android/ module functions
  • iOS operations are handled by /ios/ module functions
  • Common platform logic is in the /common utilities

These internal functions are called by the CLI commands but are not part of the public API.