Android Production Build Failed after installing ffmpeg-kit-react-native

I am adding a small video editing feature to a live Expo app using ffmpeg-kit-react-native library. While the app can run smoothly on web-dev and Expo Go, it always fails to build a production version using EAS-CLI. Before the library is installed, there was no any build problem at all.

I am using:
eas-cli 3.10.0
nodeJS 18.15.0
npm 9.5.0
MacOS 10.15
Visual Studio Code 1.77.3

package.json>

  "dependencies": {
    "@config-plugins/ffmpeg-kit-react-native": "^5.0.0",
    "@expo/webpack-config": "^18.0.1",
    "@react-native-async-storage/async-storage": "1.17.11",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-navigation/material-bottom-tabs": "^6.2.12",
    "@react-navigation/native": "^6.1.3",
    "@react-navigation/stack": "^6.3.12",
    "@reduxjs/toolkit": "^1.9.2",
    "@sentry/react-native": "4.13.0",
    "axios": "^1.3.3",
    "expo": "^48.0.10",
    "expo-application": "~5.1.1",
    "expo-av": "~13.2.1",
    "expo-build-properties": "~0.6.0",
    "expo-camera": "~13.2.1",
    "expo-clipboard": "~4.1.2",
    "expo-constants": "~14.2.1",
    "expo-device": "~5.2.1",
    "expo-file-system": "~15.2.2",
    "expo-image-picker": "~14.1.1",
    "expo-modules-core": "~1.2.5",
    "expo-navigation-bar": "~2.1.1",
    "expo-screen-orientation": "~5.1.1",
    "expo-sharing": "~11.2.2",
    "expo-status-bar": "~1.4.4",
    "expo-updates": "~0.16.4",
    "fbjs": "^3.0.4",
    "ffmpeg-kit-react-native": "^5.1.0",
    "moment": "^2.29.4",
    "react": "18.2.0",
    "react-dom": "^18.2.0",
    "react-native": "0.71.6",
    "react-native-gesture-handler": "^2.9.0",
    "react-native-global-props": "^1.1.5",
    "react-native-image-slider-banner": "^1.0.3",
    "react-native-paper": "^5.1.4",
    "react-native-radio-buttons-group": "^2.3.1",
    "react-native-raw-bottom-sheet": "^2.2.0",
    "react-native-render-html": "^6.3.4",
    "react-native-safe-area-context": "4.5.0",
    "react-native-safe-area-view": "^1.1.1",
    "react-native-screens": "~3.20.0",
    "react-native-svg": "13.4.0",
    "react-native-vector-icons": "^9.2.0",
    "react-native-view-shot": "3.5.0",
    "react-native-web": "^0.18.12",
    "react-native-webview": "11.26.0",
    "react-redux": "^8.0.5",
    "redux": "^4.2.1",
    "redux-thunk": "^2.4.2",
    "sentry-expo": "~6.1.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "eslint-plugin-react-hooks": "^4.6.0"
  },
  "private": true,
  "resolutions": {
    "@expo/config-plugins": "^6.0.0"
  }

app.json

"plugins": [
      [
        "expo-screen-orientation",
        {
          "initialOrientation": "PORTRAIT"
        }
      ],
      "sentry-expo",
      [
        "@config-plugins/ffmpeg-kit-react-native",
        {
          "package": "video"
        }
      ],
      [
        "expo-build-properties",
        {
          "android": {
            "compileSdkVersion": 31,
            "targetSdkVersion": 31,
            "minSdkVersion": 24,
            "buildToolsVersion": "31.0.0",
            "packagingOptions": {
              "pickFirst": [
                "lib/arm64-v8a/libc++_shared.so",
                "lib/armeabi-v7a/libc++_shared.so",
                "lib/x86/libc++_shared.so",
                "lib/x86_64/libc++_shared.so"
              ]
            }
          },
          "ios": {
            "deploymentTarget": "13.0"
          }
        }
      ]
    ],

Here is the gradlew error log on EAS:

[stderr] FAILURE: Build completed with 2 failures.
1294[stderr] 1: Task failed with an exception.
1295[stderr] -----------
1296[stderr] * What went wrong:
1297[stderr] Execution failed for task ':expo-image-picker:compileReleaseKotlin'.
1298[stderr] > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
1299[stderr]    > Compilation error. See log for more details
1300[stderr] * Try:
1301[stderr] > Run with --stacktrace option to get the stack trace.
1302[stderr] > Run with --info or --debug option to get more log output.
1303[stderr] > Run with --scan to get full insights.
1304[stderr] ==============================================================================
1305[stderr] 2: Task failed with an exception.
1306[stderr] -----------
1307[stderr] * What went wrong:
1308[stderr] java.lang.StackOverflowError (no error message)
1309[stderr] * Try:
1310[stderr] > Run with --stacktrace option to get the stack trace.
1311[stderr] > Run with --info or --debug option to get more log output.
1312[stderr] > Run with --scan to get full insights.
1313[stderr] ==============================================================================

Update: android production build is successful after I downgrade expo-image-picker to ~13.3.1. However, downgrading causes iOS production to fail. Restoring expo-image-picker to ~14.1.1 solves the problem.

Hence, now I cannot build production version of both platforms with the same version of expo-image-picker. This problem does not exist before I install ffmpeg-kit-react-native and its config-plugins.

There should be more info on the failure above this in the logs.

If I run npx expo-doctor on your dependencies I get this:

% npx expo-doctor
✔ Validating global prerequisites versions
✔ Checking for incompatible packages
✔ Checking for conflicting global packages in project
✖ Verifying prebuild support package versions are compatible
Issues:
  Expected package @expo/config-plugins@~6.0.0
  Found invalid:
    @expo/config-plugins@4.1.1
    (for more info, run: npm why @expo/config-plugins)
Advice:
  • Upgrade dependencies that are using the invalid package versions.
✔ Checking dependency versions for compatibility with the installed Expo SDK
✔ Validating Expo Config
✖ Checking package.json for common issues
Issues:
  The package "expo-modules-core" should not be installed directly in your project. It is a dependency of other Expo packages and should be installed automatically.

✖ Found one or more possible issues with the project. See above logs for issues and advice to resolve.

So, first uninstall/remove the expo-modules-core dependency.

After that you should use npm why to find out what’s causing the old version of @expo/config-plugins to be installed. This is what I get when I try it with your dependencies:

% npm why "@expo/config-plugins@4.1.1"
@expo/config-plugins@4.1.1
node_modules/@expo/webpack-config/node_modules/@expo/config-plugins
  @expo/config-plugins@"4.1.1" from @expo/config@6.0.20
  node_modules/@expo/webpack-config/node_modules/@expo/config
    @expo/config@"6.0.20" from @expo/webpack-config@18.0.4
    node_modules/@expo/webpack-config
      @expo/webpack-config@"^18.0.1" from the root project

This points to @expo/webpack-config being the cause of the old version of @expo/config-plugins. Do you need it? If you need to customise the Webpack config I don’t think you need that anymore. According to Bundle with webpack - Expo Documentation you just need to run npx expo customize webpack.config.js and then make changes as per the rest of that page.

If I remove that and re-run expo doctor, it no longer complains about anything.

If you do the above does it help?

1 Like

I have removed expo-modules-core dependency. I installed it to help build an iOS production in the beginning.

As for the config-plugins conflict, it has been there for a while. I will removing the webpack-config dependency in the next build.

Thanks for your help!

Hi. I have resolved the problem by moving @expo/webpack-config to devDependencies, however, there is a new problem involving exclusively EAS update. Please go to this thread Expo app refuses to launch on Expo Go (Android) but can be built into production

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.