### Run Application on Device/Simulator Source: https://context7.com/1600822305/lynx-native-cli/llms.txt Builds and installs the application on a connected device or emulator, then launches it. For Android, it finds the best APK and installs via ADB. For iOS, it builds and runs on the iOS Simulator. For Web, it starts the development server. ```bash # Run on Android device/emulator lynx run android # Installing MyLynxApp to Android device... # Target device: Pixel 6 (emulator-5554) # Installing: app-arm64-v8a-debug.apk (15.2MB) # ✓ Installation successful! # ✓ App launched successfully # Run release version lynx run android --release # Specify target device lynx run android --device emulator-5554 # Run on iOS Simulator (macOS only) lynx run ios # Running: xcodebuild -destination 'platform=iOS Simulator,name=iPhone 15' # ✓ Build successful! # Start Web development server lynx run web # Starting development server... # Visit: http://localhost:3000 ``` -------------------------------- ### Install Web Dependencies with npm Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md Instructions to install web project dependencies using npm. This involves navigating to the `web` directory and running the `npm install` command. ```bash cd web npm install ``` -------------------------------- ### Initialize Lynx Environment and Sync Dependencies Source: https://github.com/1600822305/lynx-native-cli/blob/main/templates/harmony/README.md Navigates into the cloned Lynx project directory, sources the environment setup script, and synchronizes project-dependent files. These steps prepare the project for building. ```bash cd lynx source tools/envsetup.sh tools/hab sync . ``` -------------------------------- ### Run Native Apps and Web Server with Lynx CLI Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md Installs and runs your application on a device or simulator, or starts a web development server. ```bash # Run on device lynx run android ``` ```bash # Run on iOS simulator lynx run ios ``` ```bash # Start Web dev server lynx run web ``` -------------------------------- ### Install Lynx Native CLI Source: https://context7.com/1600822305/lynx-native-cli/llms.txt Installs the Lynx Native CLI globally using npm or can be run directly using npx without prior installation. This makes the `lynx` command available in your terminal. ```bash # Global installation npm install -g lynx-native-cli # Or use npx without installation npx lynx-native-cli init ``` -------------------------------- ### Start Web Development Server with Lynx CLI Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md Command to start the development server for the web platform using the Lynx CLI. The application will be accessible at `http://localhost:3000`. ```bash lynx run web ``` -------------------------------- ### Install Harmony Project Dependencies Source: https://github.com/1600822305/lynx-native-cli/blob/main/templates/harmony/README.md Installs Harmony-specific dependencies for the project using the 'ohpm' package manager. This command is executed in the respective platform and explorer harmony subdirectories. ```bash pushd platform/harmony && ohpm install && popd pushd explorer/harmony && ohpm install && popd ``` -------------------------------- ### Install iOS Dependencies with CocoaPods Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md Instructions to install iOS project dependencies using CocoaPods. This involves navigating to the `ios` directory and running the `pod install` command. ```bash cd ios pod install ``` -------------------------------- ### Install Pre-built APK on Android Source: https://context7.com/1600822305/lynx-native-cli/llms.txt Installs a pre-built APK to a connected Android device without rebuilding. This is useful for testing existing builds or deploying to multiple devices. It supports architecture preference and force reinstall options. ```bash # Install debug APK to device lynx install android # Installing MyLynxApp to Android device... # Target device: Pixel 6 (emulator-5554) # Installing: app-arm64-v8a-debug.apk (15.2MB) # ✓ Installation successful! # ✓ App launched successfully # Install release version lynx install android --release # Install to specific device lynx install android --device ABC123DEF456 # Prefer specific architecture APK lynx install android --arch arm64 # Force reinstall (replace existing) lynx install android --force # Install without auto-launching lynx install android --no-launch ``` -------------------------------- ### Install Lynx Native CLI Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md Installs the Lynx Native CLI globally using npm or allows direct execution with npx. It's crucial to install `lynx-native-cli` and not `lynx-cli`. ```bash npm install -g lynx-native-cli ``` ```bash npx lynx-native-cli init ``` -------------------------------- ### Install HAP Package using HDC Source: https://github.com/1600822305/lynx-native-cli/blob/main/templates/harmony/README.md Installs the built Lynx Explorer HAP (Harmony Ability Package) file onto a HarmonyOS virtual device using the 'hdc' command-line tool. This is a post-build step to deploy the application. ```bash hdc install explorer/harmony/lynx_explorer/build/default/outputs/default/lynx_explorer-default-unsigned.hap ``` -------------------------------- ### Complete Lynx Development Workflow Source: https://context7.com/1600822305/lynx-native-cli/llms.txt This bash script outlines a typical workflow for cross-platform Lynx development using the CLI. It covers initialization, adding platforms, dependency installation, building, syncing, debugging, and release builds. ```bash # 1. Initialize project configuration cd my-lynx-project lynx init # 2. Add target platforms lynx add android lynx add ios lynx add web # 3. Install platform dependencies cd ios && pod install && cd .. cd web && npm install && cd .. # 4. Build Lynx application npm run build # 5. Sync bundle to native projects lynx sync # 6. Check environment lynx doctor # 7. List connected devices lynx devices # 8. Run on device for testing lynx run android # 9. View logs for debugging lynx logs android --level D # 10. Build production release lynx build android --release --arch arm64 --signed # 11. Clean up when needed lynx clean ``` -------------------------------- ### Check Development Environment Source: https://context7.com/1600822305/lynx-native-cli/llms.txt Checks the development environment for required tools and dependencies. It verifies installations like Node.js, npm, Java, Android SDK, ADB, Xcode, CocoaPods, and Git. It also displays project configuration and bundle status. ```bash lynx doctor # Checking environment... # # ✓ Node.js: 18.17.0 # ✓ npm: 9.6.7 # ✓ Java: 17.0.8 # ✓ Android SDK: /Users/dev/Library/Android/sdk # ✓ ADB: 34.0.4 # ⚠ Gradle: not found (optional) # ✓ Xcode: 15.0 # ✓ CocoaPods: 1.12.1 # ✓ Git: 2.41.0 # # Project Configuration: # App Name: MyLynxApp # App ID: com.lynx.mylynxapp # Platforms: android, ios # Bundle: ✓ main.lynx.bundle (245.3 KB) # # ───────────────────────────── # ✓ 9 passed # ⚠ 1 warnings # # All checks passed! You're ready to build. ``` -------------------------------- ### Open Native Project in IDE Source: https://context7.com/1600822305/lynx-native-cli/llms.txt Opens the native project in the appropriate IDE. Android projects open in Android Studio, iOS projects in Xcode, and Web projects in VS Code. It automatically detects IDE installation paths on Windows and macOS. ```bash # Open Android project in Android Studio lynx open android # ✓ Opening in Android Studio... # Open iOS project in Xcode (macOS only) lynx open ios # ✓ Opening in Xcode... # Opens App.xcworkspace if exists, otherwise App.xcodeproj # Open Web project in VS Code lynx open web # ✓ Opening in VS Code... ``` -------------------------------- ### Initialize Lynx Native Project Configuration Source: https://context7.com/1600822305/lynx-native-cli/llms.txt Initializes Lynx Native project configuration by creating a `lynx.config.json` file. It interactively prompts for application name, ID, build output directory, and bundle filename, then generates the configuration file. ```bash # Initialize in your Lynx project cd your-lynx-project lynx init # Interactive prompts: # ? Application name: MyLynxApp # ? Application ID (e.g., com.example.app): com.lynx.mylynxapp # ? Build output directory: dist # ? Bundle filename: main.lynx.bundle # Creates lynx.config.json: { "appName": "MyLynxApp", "appId": "com.lynx.mylynxapp", "distDir": "dist", "bundleName": "main.lynx.bundle", "platforms": {}, "created": "2025-01-15T10:30:00.000Z" } ``` -------------------------------- ### Configure DevEco Studio SDK Path Source: https://github.com/1600822305/lynx-native-cli/blob/main/templates/harmony/README.md Sets the DEVECO_SDK_HOME environment variable to the DevEco Studio SDK directory. This is necessary for build scripts that rely on DevEco Studio's SDK components. ```bash export DEVECO_SDK_HOME=/Applications/DevEco-Studio.app/Contents/sdk ``` -------------------------------- ### Initialize Lynx Project Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md Initializes a new Lynx project configuration. This command should be run within the root directory of your Lynx project. ```bash cd your-lynx-project lynx init ``` -------------------------------- ### Add Native Platform Projects (Android, iOS, Web, HarmonyOS) Source: https://context7.com/1600822305/lynx-native-cli/llms.txt Generates complete native platform projects from templates for Android, iOS, Web, and HarmonyOS. It replaces placeholders with configured application details and sets up necessary build configurations and asset directories. ```bash # Add Android platform lynx add android # Output: android/ directory with complete Gradle project # ├── app/ # │ ├── build.gradle.kts # │ └── src/main/ # │ ├── AndroidManifest.xml # │ ├── java/com/example/app/ # │ └── assets/ (bundle destination) # └── gradlew # Add iOS platform (macOS only) lynx add ios # Output: ios/ directory with Xcode project # ├── App.xcodeproj/ # ├── App/ # │ ├── Sources/ # │ └── Assets/ (bundle destination) # └── Podfile # Add Web platform lynx add web # Output: web/ directory with rsbuild project # ├── src/ # ├── public/assets/ (bundle destination) # └── package.json # Add HarmonyOS platform lynx add harmony # Output: harmony/ directory with DevEco Studio project # ├── lynx_explorer/ # │ └── src/main/resources/rawfile/ (bundle destination) # └── oh-package.json5 ``` -------------------------------- ### Clone Lynx Repository Source: https://github.com/1600822305/lynx-native-cli/blob/main/templates/harmony/README.md Clones the Lynx project from its GitHub repository. This command downloads the entire source code of the Lynx project to the local machine. ```bash git clone https://github.com/lynx-family/lynx.git ``` -------------------------------- ### Configure HarmonyOS SDK Path Source: https://github.com/1600822305/lynx-native-cli/blob/main/templates/harmony/README.md Sets the HARMONY_HOME environment variable to the HarmonyOS SDK directory. This is crucial for locating SDK components and tools required for building HarmonyOS applications. ```bash export HARMONY_HOME=/Applications/DevEco-Studio.app/Contents/sdk/ ``` -------------------------------- ### Complete Lynx Development Workflow Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md A comprehensive sequence of commands for the complete Lynx development workflow, including project initialization, adding platforms, development, debugging, syncing, and building for release. ```bash # 1. Project initialization lynx init # 2. Add platforms lynx add android lynx add ios # 3. Development & debugging npm run dev # Start Lynx dev server lynx devices # View connected devices lynx sync # Sync bundle lynx run android # Run on device lynx logs android # View real-time logs # 4. Build for release npm run build # Build Lynx app lynx sync # Sync to native projects lynx build android --arch arm64 --signed # Build signed APK ``` -------------------------------- ### List Connected Devices and Simulators Source: https://context7.com/1600822305/lynx-native-cli/llms.txt Lists all connected Android devices and iOS simulators. It displays device ID, name, platform, status, and model information, which is useful for identifying device IDs for use with `--device` options. ```bash # List all connected devices lynx devices # Found 3 device(s): # # 🤖 Pixel 6 # ID: emulator-5554 # Platform: android # Status: online # Model: sdk_gphone64_arm64 # # 🤖 Samsung Galaxy S23 # ID: RF8N90XXXXX # Platform: android # Status: online # Model: SM-S911B # # 🍎 iPhone 15 Pro # ID: 12345678-ABCD-EFGH-IJKL-MNOPQRSTUVWX # Platform: ios # Status: booted # Model: com.apple.CoreSimulator.SimRuntime.iOS-17-0 # # Usage: # lynx run android --device # lynx logs android --device # Show only Android devices lynx devices --android # Show only iOS devices (macOS only) lynx devices --ios ``` -------------------------------- ### Build and Sync Lynx App to Native Projects Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md Builds your Lynx application and syncs the bundle to the native projects. This is a crucial step before building native applications. ```bash npm run build ``` ```bash lynx sync ``` ```bash lynx sync --platform android ``` -------------------------------- ### Add Hivigor Tool to PATH Source: https://github.com/1600822305/lynx-native-cli/blob/main/templates/harmony/README.md Appends the path to the 'hvigorw' tool, used for building HarmonyOS applications, to the system's PATH environment variable. This enables running 'hvigorw' commands from anywhere. ```bash export PATH=/Applications/DevEco-Studio.app/Contents/tools/hvigor/bin:$PATH ``` -------------------------------- ### Build Native Applications (Android, iOS) Source: https://context7.com/1600822305/lynx-native-cli/llms.txt Builds native applications for Android or iOS platforms, supporting debug and release configurations. It allows for architecture-specific builds (e.g., ARM64) and signed release builds for distribution, utilizing Gradle for Android and xcodebuild for iOS. ```bash # Build debug APK lynx build android # Running: ./gradlew assembleDebug --no-daemon # ✓ Build successful! # APK location: android/app/build/outputs/apk/debug/ # Build release APK lynx build android --release # ✓ Build successful! # APK location: android/app/build/outputs/apk/release/ # Build for specific architecture (smaller APK) lynx build android --arch arm64 # Available APKs: # ✓ app-arm64-v8a-debug.apk (15.2MB) ← arm64 # app-armeabi-v7a-debug.apk (14.8MB) # app-x86-debug.apk (16.1MB) lynx build android --arch arm32 # ARM 32-bit lynx build android --arch x86 # x86 emulators lynx build android --arch universal # All architectures # Build signed release APK lynx build android --signed --release # Requires signingConfigs in android/app/build.gradle.kts # Build iOS (macOS only) lynx build ios # Running: xcodebuild -workspace App.xcworkspace -scheme App ... # ✓ Build successful! lynx build ios --release ``` -------------------------------- ### Manage Devices with Lynx CLI Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md Lists connected devices and allows filtering by platform. Useful for targeting specific devices during development and debugging. ```bash # List all connected devices lynx devices ``` ```bash # Show only Android devices lynx devices --android ``` ```bash # Show only iOS devices lynx devices --ios ``` -------------------------------- ### Synchronize Lynx Bundle to Platform Assets Source: https://context7.com/1600822305/lynx-native-cli/llms.txt Synchronizes the built Lynx bundle and assets from the distribution directory to the asset directories of configured native platforms. It can sync to all platforms or a specific platform using the `--platform` flag. ```bash # Build Lynx app first npm run build # Sync to all platforms lynx sync # ✓ Synced to android # → android/app/src/main/assets/ # Assets copied: static, images # ✓ Synced to ios # → ios/App/Assets/ # ✓ Sync complete! # Sync to specific platform only lynx sync --platform android # ✓ Synced to android # → android/app/src/main/assets/ # Platform asset destinations: # Android: android/app/src/main/assets/ # iOS: ios/App/Assets/ # Web: web/public/assets/ # HarmonyOS: harmony/lynx_explorer/src/main/resources/rawfile/ ``` -------------------------------- ### Build and Run iOS App with Lynx CLI Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md Commands to build and run the iOS application using the Lynx CLI. The `lynx run ios` command is used to launch the app in the simulator. ```bash lynx build ios lynx run ios # Run in simulator ``` -------------------------------- ### Add Harmony Tools to PATH Source: https://github.com/1600822305/lynx-native-cli/blob/main/templates/harmony/README.md Appends the paths for the 'ohpm' package manager and HarmonyOS toolchains to the system's PATH environment variable. This allows these tools to be executed from any directory in the terminal. ```bash export PATH=/Applications/DevEco-Studio.app/Contents/tools/ohpm/bin:$HARMONY_HOME/default/openharmony/toolchains:$PATH ``` -------------------------------- ### View Application Logs with Lynx CLI Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md Displays real-time application logs for specified platforms. Supports filtering by device, log level, and clearing log history. ```bash # View Android app logs lynx logs android ``` ```bash # Specific device lynx logs android --device ``` ```bash # Set log level (V/D/I/W/E) lynx logs android --level W ``` ```bash # Clear log history lynx logs android --clear ``` ```bash # Show all logs (unfiltered) lynx logs android --all ``` -------------------------------- ### Build Lynx Explorer for Harmony (CLI) Source: https://github.com/1600822305/lynx-native-cli/blob/main/templates/harmony/README.md Builds the Lynx Explorer application for HarmonyOS using a Python script. This command can be configured to build debug or release versions, include core libraries, bundles, and the final HAP package. ```python python3 explorer/harmony/script/build.py --debug --dev --build_lynx_core --build_bundle --build_hap ``` -------------------------------- ### Lynx Project Configuration File Source: https://context7.com/1600822305/lynx-native-cli/llms.txt The `lynx.config.json` file stores project configuration for all CLI commands. It defines application identity, build paths, and tracks added platforms. This JSON file is essential for customizing and managing Lynx projects. ```json { "appName": "MyLynxApp", "appId": "com.example.myapp", "distDir": "dist", "bundleName": "main.lynx.bundle", "platforms": { "android": { "path": "android", "added": "2025-01-15T10:30:00.000Z" }, "ios": { "path": "ios", "added": "2025-01-15T10:31:00.000Z" }, "web": { "path": "web", "added": "2025-01-15T10:32:00.000Z" }, "harmony": { "path": "harmony", "added": "2025-01-15T10:33:00.000Z" } }, "created": "2025-01-15T10:30:00.000Z" } ``` -------------------------------- ### Lynx Android Build Optimization Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md Commands for optimizing Android builds with the Lynx CLI, focusing on architecture and release configurations. Options include building for specific architectures (arm64, universal) and creating signed release APKs. ```bash # Small APK (recommended) lynx build android --arch arm64 # Compatibility APK lynx build android --arch universal # Release version lynx build android --signed --release --arch arm64 ``` -------------------------------- ### Build Native Applications with Lynx CLI Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md Builds native applications for different platforms. Supports various configurations including release builds, architecture-specific builds, and signed builds for Android. ```bash # Android APK lynx build android ``` ```bash # iOS (requires macOS) lynx build ios ``` ```bash # Web lynx build web ``` ```bash # Release APK lynx build android --release ``` ```bash # Architecture-specific builds lynx build android --arch arm64 lynx build android --arch arm32 lynx build android --arch x86 lynx build android --arch universal ``` ```bash # Signed builds lynx build android --signed --release ``` -------------------------------- ### IDE Integration with Lynx CLI Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md Opens the native projects in their respective IDEs for development. Supports Android Studio, Xcode, and VS Code for web. ```bash # Open in Android Studio lynx open android ``` ```bash # Open in Xcode lynx open ios ``` ```bash # Open in VS Code lynx open web ``` -------------------------------- ### Lynx Configuration File Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md The `lynx.config.json` file defines application settings and platform-specific configurations. It includes details like app name, ID, distribution directory, bundle name, and paths for different platforms (android, ios, web, harmony). ```json { "appName": "My App", "appId": "com.example.app", "distDir": "dist", "bundleName": "main.lynx.bundle", "platforms": { "android": { "path": "android" }, "ios": { "path": "ios" }, "web": { "path": "web" }, "harmony": { "path": "harmony" } } } ``` -------------------------------- ### Build Android APK with Lynx CLI Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md Commands to build Android APKs using the Lynx CLI. Supports both debug and release builds. The output APKs are located in `android/app/build/outputs/apk/`. ```bash # Debug APK lynx build android # Release APK lynx build android --release ``` -------------------------------- ### Lynx CLI Debugging and Maintenance Commands Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md Utility commands for debugging and maintaining Lynx projects. Includes environment checks, device management, log viewing, and cleaning build caches. ```bash # Environment check lynx doctor # Device management lynx devices --android # Android devices only lynx logs android --level E # Error logs only lynx logs android --device xxx # Specific device logs # Project maintenance lynx clean # Clean build cache lynx clean --all # Full clean (including deps) ``` -------------------------------- ### Run Android App on Device with Lynx CLI Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md Command to run the Android application on a connected device or emulator using the Lynx CLI. ```bash lynx run android ``` -------------------------------- ### Add Native Platforms to Lynx Project Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md Adds support for specific native platforms to your Lynx project. This includes Android, iOS (requires macOS), Web, and HarmonyOS. ```bash # Android lynx add android ``` ```bash # iOS (requires macOS) lynx add ios ``` ```bash # Web lynx add web ``` ```bash # HarmonyOS lynx add harmony ``` -------------------------------- ### Clean Build Caches with Lynx CLI Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md Cleans build caches for the project. Supports cleaning all caches, including node_modules, or specific platform caches. ```bash # Clean all build caches lynx clean ``` ```bash # Including node_modules lynx clean --all ``` ```bash # Clean Android cache only lynx clean --android ``` ```bash # Clean iOS cache only lynx clean --ios ``` ```bash # Clean native platforms only lynx clean --native ``` -------------------------------- ### Clean Build Caches with Lynx CLI Source: https://context7.com/1600822305/lynx-native-cli/llms.txt The `lynx clean` command removes build caches and generated files. It can clean all Lynx build output, platform-specific directories, and optionally `node_modules`. This is useful for resolving build issues or freeing up disk space. ```bash # Clean all build caches lynx clean # Cleaning project... # # ✓ Clean completed! # # Cleaned: # ✓ Lynx build output (dist) # ✓ Android build cache (android/build) # ✓ Android build cache (android/app/build) # ✓ Gradle clean # ✓ iOS build cache (ios/build) # ✓ CocoaPods cache # ✓ Web build cache (web/dist) # Clean everything including node_modules lynx clean --all # Cleaned: # ✓ Dependencies (node_modules) # ✓ Dependencies (web/node_modules) # Clean only Android lynx clean --android # Clean only iOS lynx clean --ios # Clean only native platforms (not Lynx output) lynx clean --native ``` -------------------------------- ### Check Development Environment with Lynx Doctor Source: https://github.com/1600822305/lynx-native-cli/blob/main/README.en.md The `doctor` command checks your development environment to ensure all necessary dependencies and configurations are set up correctly for Lynx development. ```bash lynx doctor ``` -------------------------------- ### Stream Real-time Application Logs Source: https://context7.com/1600822305/lynx-native-cli/llms.txt Streams real-time application logs from connected devices. For Android, it uses ADB logcat with optional filtering by app, log level, and device. For iOS, it uses xcrun simctl log streaming with app filtering. ```bash # View Android logs (filtered by app) lynx logs android # Starting Android logs for MyLynxApp... # Press Ctrl+C to stop # # D/LynxView: Template loaded successfully # I/LynxCore: Rendering component... # V/LynxBridge: JS bridge call: getData # View logs from specific device lynx logs android --device emulator-5554 # Set minimum log level (V/D/I/W/E) lynx logs android --level W # Warnings and errors only lynx logs android --level E # Errors only # Show all system logs (unfiltered) lynx logs android --all # Clear log buffer before streaming lynx logs android --clear # View iOS Simulator logs (macOS only) lynx logs ios # Starting iOS logs for MyLynxApp... # Press Ctrl+C to stop ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.