SettingsPrebuild

Prebuilding Your TV App Project

🔨

This chapter covers the prebuild process that configures your React Native project for TV platforms. This is a crucial step that sets up all necessary native configurations for TV development.

What is Prebuilding?

ℹ️

Prebuilding generates native code and configurations for specific TV platforms based on your React Native project. This process adapts your app for TV-specific requirements and capabilities.

Why is Prebuilding Necessary for TV?

TV platforms have unique requirements compared to mobile devices:

  • Different input methods (remote controls instead of touch)
  • Larger screen sizes and resolutions
  • Specific UI/UX guidelines for TV interfaces
  • Platform-specific APIs and features

The Prebuild Process

Set Environment Variable

First, we need to tell the prebuild process to target TV platforms:

export EXPO_TV=1

Run Prebuild Command

Execute the complete prebuild command:

export EXPO_TV=1; npx expo prebuild

Wait for Completion

The process will run through several stages:

  • Platform detection
  • Native project generation
  • Dependency configuration
  • Asset preparation
  • Build script modification
  • Plugin application

Project Structure Changes

After prebuilding, your project structure will change to include TV-specific files:

      • YourTVApp.xcodeproj
      • Podfile
      • build.gradle
      • settings.gradle
    • app.json
    • package.json

Verification and Troubleshooting

⚠️

If the prebuild process fails, try these steps:

  1. Verify all dependencies are installed
  2. Update Expo CLI: npm install -g expo-cli
  3. Clean and rebuild: npx expo prebuild --clean
  4. Check your app.json configuration
🚫

Common prebuild errors include:

  • Missing dependencies
  • Incorrect environment setup
  • Incompatible package versions
  • Invalid TV platform configurations

Success Checklist:

  • New ios and android directories created
  • TV-specific entries added to app.json
  • TV assets properly configured
  • No errors in terminal output

Next Steps

With prebuilding complete, you’re ready to run your app on TV platforms and emulators. The next chapter will cover how to launch and test your app on different TV devices.