You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Studio终端中如何正确设置ExoPlayer FFmpeg扩展环境变量?

Fixing ExoPlayer FFmpeg Extension Environment Variable Errors in Android Studio Terminal

Hey there, let’s get this sorted out—those "not recognized" errors are happening because you’re using Unix-style command syntax in a Windows terminal (Android Studio’s default terminal on Windows is usually Command Prompt or PowerShell, which follow different variable-setting rules than Linux/macOS). Here’s how to fix it based on your terminal type:

For Windows Command Prompt (Cmd)

  1. First navigate to your ExoPlayer checkout directory:

    cd "<path to exoplayer checkout>"
    

    Keep the quotes around your path if it includes spaces, and replace <path to exoplayer checkout> with your actual folder location.

  2. Set the EXOPLAYER_ROOT variable using Windows Cmd’s syntax:

    set EXOPLAYER_ROOT=%cd%
    

    %cd% automatically grabs the full path of your current directory.

  3. Define the FFmpeg extension path:

    set FFMPEG_EXT_PATH=%EXOPLAYER_ROOT%\extensions\ffmpeg\src\main
    
  4. Verify the variables are set correctly:

    echo %EXOPLAYER_ROOT%
    echo %FFMPEG_EXT_PATH%
    

For Windows PowerShell

If you’re using PowerShell instead of Cmd, use these commands:

  1. Navigate to your ExoPlayer directory:

    cd "<path to exoplayer checkout>"
    
  2. Set the root variable with PowerShell’s location command:

    $EXOPLAYER_ROOT = Get-Location
    
  3. Build the FFmpeg path using PowerShell’s path-joining tool:

    $FFMPEG_EXT_PATH = Join-Path $EXOPLAYER_ROOT "extensions\ffmpeg\src\main"
    
  4. Check if the variables work as expected:

    echo $EXOPLAYER_ROOT
    echo $FFMPEG_EXT_PATH
    

For Linux/macOS or WSL Terminal

If you’re using a Unix-like terminal (like on Mac, or Windows Subsystem for Linux), your original command just needs to separate commands with && to run them in sequence:

cd "<path to exoplayer checkout>" && EXOPLAYER_ROOT="$(pwd)" && FFMPEG_EXT_PATH="${EXOPLAYER_ROOT}/extensions/ffmpeg/src/main"

Alternatively, run them one line at a time for clarity:

cd "<path to exoplayer checkout>"
EXOPLAYER_ROOT="$(pwd)"
FFMPEG_EXT_PATH="${EXOPLAYER_ROOT}/extensions/ffmpeg/src/main"

Bonus: Making Variables Permanent (Optional)

If you set variables in Windows System Properties but Android Studio’s terminal still doesn’t recognize them, you need to restart Android Studio—the terminal inherits environment variables when the app launches, so changes won’t take effect until you restart it.

For Unix-like systems, you can add the variable definitions to your shell config file (e.g., ~/.bashrc or ~/.zshrc) to have them available every time you open a terminal.

Don’t forget to double-check your ExoPlayer checkout path—typos in the path are a common hidden culprit!

内容的提问来源于stack exchange,提问作者Abdullah Khan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 07:38:54