Expo Error getaddrinfo ENOTFOUND assets expo

my app is ejected from expo so i have to do expo publish every time i do release build the method was working perfectly for more than 50 times but suddenly after doing the expo publish when i try to do archive in xcode or generate the release build in android iam getting the following error

In Xcode :

Showing All Messages
https://assets/3c851d60ad5ef3f2fe43ebd263490d78
https://assets/1a0e3525dd5df87e77057204129a5e6e
https://assets/2379ae894c2c9f63b852a9f3676c2763
https://assets/5cdf883b18a5651a29a4d1ef276d2457
https://assets/74d124a3caeac2bea111f3ca2f2dd34a
[20:37:23] Error: getaddrinfo ENOTFOUND assets

[20:37:23] Before making a release build, make sure you have run 'expo publish' at least once. Learn more. (​https://expo.fyi/release-builds-with-expo-updates​)

In Android :

> Task :app:bundleReleaseExpoUpdatesAssets
https://assets/3c851d60ad5ef3f2fe43ebd263490d78
https://assets/1a0e3525dd5df87e77057204129a5e6e
https://assets/2379ae894c2c9f63b852a9f3676c2763
https://assets/5cdf883b18a5651a29a4d1ef276d2457
https://assets/74d124a3caeac2bea111f3ca2f2dd34a
[21:22:20] Error: getaddrinfo ENOTFOUND assets
[21:22:20] Before making a release build, make sure you have run 'expo publish' at least once. Learn more. 

Even though my expo publish is done and if i try to build archive or apk iam getting the error

I tried clear watchman, remove node modules,reinstall pod,clear cache.etc Nothing helps


Did try this solution using the instructions from the pdf but didn't work for me. Spent days looking for solutions but nothing worked for me so I dug into the issue.

My project is using Expo SDK36.

What worked for me is the following solution.

Requirements

  1. Install expo-cli: npm install expo-cli --save-dev.

Whenever we make a build using Xcode Archive or Android Gradle assembleRelease command, these executes the expo bundle-assets command. We are going to replace expo and use the local expo-cli in the following steps.

iOS Specific solution

  1. After installing expo-cli in our project, we need to replace build commands.
  2. Go to Xcode > Project Name > Targets > Select you project > Build Phases
  3. Under Build Phases > Go to Expo Bundle Assets or something similar enter image description here
  4. Replace: expo bundle-assets --platform ios --dest "$dest" with npx expo-cli bundle-assets --platform ios --dest "$dest"
  5. Run npx expo-cli publish --clear
  6. Clean the project and start archiving/building! 🚀

Android specific solution (for MacOS/Linux)

  1. On your project root folder, create a file named run-exp.sh.
  2. Add these lines inside of run-exp.sh:
#!/usr/bin/env bash

value=$(cat ~/.expo/PATH)
PATH="$PATH:$value" npx expo-cli "$@"
  1. Under Project Root Folder, go to android/app/expo.gradle
  2. Replace this line:
commandLine("./node_modules/expokit/detach-scripts/run-exp.sh", "bundle-assets", expoRoot, "--platform", "android", "--dest", assetsDir)

with

commandLine("./run-exp.sh", "bundle-assets", expoRoot, "--platform", "android", "--dest", assetsDir)
  1. Run npx expo-cli publish --clear
  2. On Android studio, clean the project and build the app 🚀

Android specific solution (for Windows)

  1. On your project root folder, create a file named run-exp.bat.
  2. Add these lines inside of run-exp.bat:
SET /P STOREDPATH=<"%USERPROFILE%\.expo\PATH"
SET PATH="\"%PATH%;%STOREDPATH%\""
npx expo-cli %*
  1. Under Project Root Folder, go to android/app/expo.gradle
  2. Replace this line:
commandLine("cmd", "/c", ".\\node_modules\\expokit\\detach-scripts\\run-exp.bat", "bundle-assets", expoRoot, "--platform", "android", "--dest", assetsDir)

with

commandLine("cmd", "/c", ".\\run-exp.bat", "bundle-assets", expoRoot, "--platform", "android", "--dest", assetsDir)
  1. Run npx expo-cli publish --clear
  2. On Android studio, clean the project and build the app 🚀