react-nativeexpo

React Native Build Fails with expo-modules-core:prepareBoost Error: "Not in GZIP Format"


I'm facing an issue while building my React Native project. The build fails with the following error related to expo-modules-core:

Execution failed for task ':expo-modules-core:prepareBoost'.
> Could not read C:\Users\netwo\Desktop\Ekhool Project\Android Project\expo-app\node_modules\expo-modules-core\android\build\downloads\boost_1_76_0.tar.gz.
   > Not in GZIP format

This error seems to be caused by a corrupted or incomplete boost_1_76_0.tar.gz file in the expo-modules-core dependency.

  1. How can I ensure that the boost_1_76_0.tar.gz file is correctly downloaded?

  2. Are there any alternative ways to bypass or fix this issue without modifying the expo-modules-core package?

  3. Is there a specific Boost version or manual installation process I should follow to resolve this?


Solution

  • Fixed the Issue with Boost Library

    Step 1: Update URL in ReactAndroid Build Script

    Navigate to the file: /node_modules/react-native/ReactAndroid/build.gradle

    Locate the following line:

    https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION.replace("_", ".")}/source/boost_${BOOST_VERSION}.tar.gz

    Replace it with:

    https://archives.boost.io/release/${BOOST_VERSION.replace("_", ".")}/source/boost_${BOOST_VERSION}.tar.gz

    Step 2: Update URL in Expo Modules Core

    Go to the file: /node_modules/expo-modules-core/android/build.gradle. Search for the same URL as in Step 1. Replace it with the new URL provided in Step 1. Step 3: Apply the Patches

    After making the changes, run the following commands to apply the patches:

    patch-package react-native
    patch-package expo-modules-core
    

    We need to install patch-package first. npm i -D patch-package and add "postinstall": "patch-package" to package.json