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:UsersnetwoDesktopEkhool ProjectAndroid Projectexpo-appnode_modulesexpo-modules-coreandroidbuilddownloadsboost_1_76_0.tar.gz.
> Not in GZIP format
-
React Native version: 0.69.5
-
Expo SDK version: Ejected (SDK 46)
-
Environment:
-
OS: Windows
-
Gradle Version: 7.4.2
-
JDK: OpenJDK 11
-
This error seems to be caused by a corrupted or incomplete boost_1_76_0.tar.gz
file in the expo-modules-core
dependency.
-
How can I ensure that the
boost_1_76_0.tar.gz
file is correctly downloaded? -
Are there any alternative ways to bypass or fix this issue without modifying the
expo-modules-core
package? -
Is there a specific Boost version or manual installation process I should follow to resolve this?
2
Answers
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:
We need to install patch-package first.
npm i -D patch-package
and add"postinstall": "patch-package"
to package.jsonI was able to fix it by changing the url that was not working in these two files (when adding it only in node_modules/react-native, the expo-modules-core error appeared) new url:
"https://sourceforge.net/projects/boost/files/boost/1.76.0/boost_1_76_0.tar.gz/download"
node_modules/react-native/ReactAndroid/android/build.gradle
node_modules/expo-modules-core/android/build.gradle
and then
cd android && ./gradlew clean