as

Settings
Sign out
Notifications
Alexa
Amazonアプリストア
AWS
ドキュメント
Support
Contact Us
My Cases
開発
設計と開発
公開
リファレンス
サポート
アクセスいただきありがとうございます。こちらのページは現在英語のみのご用意となっております。順次日本語化を進めてまいりますので、ご理解のほどよろしくお願いいたします。

Set Up Fast Refresh to Build Apps Using Vega CLI

Fast Refresh is a React Native feature that lets you see code changes instantly without rebuilding your app. Fast Refresh works in both Vega Studio and Vega command-line interface (CLI) environments. While Vega Studio automatically enables Fast Refresh if building in Debug mode, you must manually configure Fast Refresh when building apps using Vega CLI. Follow the instructions on this page.

Prerequisites

  1. Install the Vega SDK.
  2. Complete setup of either:


Connect your Vega Virtual Device to Metro Server

Have your app's directory path ready:

  1. Open two terminal windows (A and B).
  2. Start the Vega Virtual Device in terminal A:

    Copied to clipboard.

    kepler virtual-device start
    
  3. Navigate to your app’s directory in terminal B:

    cd <your app directory>
    
    // Example output
    cd keplersampleapp
    
  4. Install the dependencies:

    Copied to clipboard.

    npm install
    
  5. Build the app:

    Copied to clipboard.

    npm run build:debug
    
  6. Start the Metro Server in terminal B:

    Copied to clipboard.

    npm start
    

    The Metro Server loads dependencies and displays its logo.

    Metro Server
    Metro Server
  7. Return to terminal A and start port forwarding:

    kepler device start-port-forwarding --device <DEVICE_NAME> -p <PORT> --forward false
    
    // Example output
    kepler device start-port-forwarding --device VirtualDevice -p 8081 --forward false
    
  8. Run your app using the debug build:

    kepler run-kepler <PATH_TO_VPKG> <com.amazondeveloper.YOUR_APP_NAME.main> -d VirtualDevice
    
    # To run `keplersampleapp` on x86 Vega Virtual Device, the command is:
    kepler run-kepler build/x86_64-release/keplersampleapp_x86_64.vpkg com.amazondeveloper.keplersampleapp.main -d VirtualDevice
    

Use a custom Metro Bundler port

Metro Bundler supports changing the default port.

  1. Start Metro on a custom port:

    npm start -- --port=<new_port>
    
  2. Reverse-port-forward the custom port on the host:

    vda reverse tcp:8081 tcp:<new_port>
    

End the Fast Refresh session

When you finish working on your app with Fast Refresh, you can:

  1. Close your app.

    kepler device terminate-app --device <DEVICE_NAME> --appName <com.amazondeveloper.YOUR_APP_NAME.main>
    
    # The command to close the `keplersampleapp` on the Vega Virtual Device is:
    kepler device terminate-app --device VirtualDevice --appName com.amazondeveloper.keplersampleapp.main
    
  2. Press Ctrl+C to stop the Metro Server.

  3. Stop port forwarding:

    kepler device stop-port-forwarding --device <DEVICE_NAME> -p <PORT> --forward false
    
    # The command to stop port forwarding for the `keplersampleapp` on the Vega Virtual Device is:
    kepler device stop-port-forwarding --device VirtualDevice -p 8081 --forward false
    
  4. Stop the Vega Virtual Device:

    Copied to clipboard.

    kepler virtual-device stop
    

Connect your Fire TV Stick to Metro Server

  1. Connect your Fire TV Stick to your computer.

    If you're a macOS user, you see a security prompt when connecting your Fire TV Stick to your computer. Click Allow.

    Allow accessory to connect
    Allow accessory to connect

    To avoid future prompts:

    a. Go to Configuration > Privacy & Security.

    b. Set Allow accessories to connect to Always.

    Set accessory to connect
    Allow accessories to connect
  2. Open two terminal windows (A and B).
  3. Navigate to your app’s directory in terminal A:

    cd <your app directory>
    
    // Example output
    cd keplersampleapp
    
  4. Start the Metro Server in terminal A:

    Copied to clipboard.

    npm start
    

    The Metro Server loads dependencies and displays its logo.

    Metro Server
    Metro Server
  5. Press r in the Metro Server window.
  6. Start port forwarding in terminal B:

    kepler device start-port-forwarding --device <DEVICE_NAME> -p <PORT> --forward false
    
    # For example, if your device serial number is `GXX2A1234567890A`, the full command would be:
    
    kepler device start-port-forwarding --device GXX2A1234567890A -p 8081 --forward false
    

    To check for your device's serial number, run the following command:

    Copied to clipboard.

    kepler device list
    
  7. Install the dependencies:

    Copied to clipboard.

    npm install
    
  8. Build your app:

    Copied to clipboard.

    npm run build:app
    
  9. Run your app:

    kepler run-kepler <PATH_TO_VPKG> <com.amazondeveloper.YOUR_APP_NAME.main> --deviceId <DEVICE_NAME>
    
    # To run the `keplersampleapp` app with the device serial number `GXX2A1234567890A`, the command would be:
    kepler run-kepler build/armv7-release/keplersampleapp_armv7.vpkg --deviceId GXX2A1234567890A
    

Use a custom Metro Bundler port

Metro Bundler supports changing the default port.

  1. Start Metro on a custom port:

    npm start -- --port=<new_port>
    
  2. Reverse-port-forward the custom port on the host:

    vda reverse tcp:8081 tcp:<new_port>
    

End the Fast Refresh session

When you finish working on your app with Fast Refresh, disconnect the device.

Troubleshooting

If you encounter an issue while setting up Fast Refresh, visit Resolve Fast Refresh Issues.


Last updated: Sep 30, 2025