乐闻世界logo
搜索文章和话题

What are the differences between Expo CLI and Expo Go? How do they work together?

2月21日 16:06

Expo CLI and Expo Go are two core tools in the Expo development workflow, each serving different responsibilities and working together to provide an efficient development experience.

Expo CLI:

Expo CLI is a command-line tool used to create, build, and manage Expo projects.

Main Features:

  1. Project Initialization: Quickly create new Expo projects via npx create-expo-app command, supporting multiple templates including TypeScript and JavaScript.

  2. Development Server: Start a development server that compiles code in real-time and provides hot reloading functionality.

  3. Build Configuration: Configure and manage project build settings, including app icons, splash screens, permission configurations, etc.

  4. Package and Publish: Support building APK, IPA installation packages, or publishing directly to Expo servers.

  5. Dependency Management: Install and update Expo SDK versions and dependency packages.

Common Commands:

bash
npx create-expo-app my-app npx expo start npx expo build:android npx expo build:ios

Expo Go:

Expo Go is a mobile application that can be installed on Android and iOS devices, used for real-time previewing and testing of Expo apps.

Main Features:

  1. Real-time Preview: View app effects on real devices by scanning QR codes or entering URLs.

  2. No Build Required: No need to compile native code during development, significantly improving development efficiency.

  3. Cross-device Testing: Test apps on multiple devices simultaneously, verifying compatibility with different screen sizes and system versions.

  4. Built-in SDK: Contains the complete Expo SDK, supporting all Expo components and APIs.

Workflow:

  1. Use Expo CLI to create a project and start the development server
  2. Install the Expo Go app on mobile devices
  3. Connect to the development server via Expo Go
  4. View code modification effects in real-time

Limitations:

Expo Go does not support custom native code. If the project needs to add custom native modules, you need to use Expo Development Build or the Eject process.

Best Practices:

  • Prioritize using Expo Go for rapid iteration during development
  • Use Development Build during testing for behavior closer to production environment
  • Use EAS Build for production builds to generate optimized installation packages

The combination of these two tools makes the Expo development workflow both fast and flexible, suitable for the complete development cycle from prototype to production.

标签:Expo