EAS error build Android : withAndroidManifestBaseMod: Cannot read property 'manifest' of null

Dear Team,

Happy New Year, I hope the year will be good for you.
I have a problem when I want to build my Android project with eas build.
Indeed, I have this error message :

Prebuilding managed project
- Creating native project directories (./ios and ./android) and updating .gitignore
✔ Created native project | /android already created | gitignore already synced
- Adding Metro bundler config
- Updating your package.json scripts, dependencies, and main file
✔ Updated package.json and added index.js entry point for iOS and Android
- Config syncing
✖ Config sync failed
[stderr] [10:11:58] [android.manifest]: withAndroidManifestBaseMod: Cannot read property 'manifest' of null
[stderr] [10:11:58] TypeError: [android.manifest]: withAndroidManifestBaseMod: Cannot read property 'manifest' of null
[stderr]     at isManifest (/build/node_modules/@expo/config-plugins/src/android/Manifest.ts:172:16)
[stderr]     at Object.readAndroidManifestAsync (/build/node_modules/@expo/config-plugins/src/android/Manifest.ts:164:8)
[stderr]     at read (/build/node_modules/@expo/config-plugins/src/plugins/withAndroidBaseMods.ts:126:16)
[stderr]     at action (/build/node_modules/@expo/config-plugins/src/plugins/createBaseMod.ts:80:30)
[stderr]     at interceptingMod (/build/node_modules/@expo/config-plugins/src/plugins/withMod.ts:108:21)
[stderr]     at evalModsAsync (/build/node_modules/@expo/config-plugins/src/plugins/mod-compiler.ts:172:25)
[stderr]     at compileModsAsync (/build/node_modules/@expo/config-plugins/src/plugins/mod-compiler.ts:82:10)
[stderr]     at configureManagedProjectAsync (/build/node_modules/expo-cli/src/commands/eject/configureProjectAsync.ts:64:12)
[stderr]     at prebuildAsync (/build/node_modules/expo-cli/src/commands/eject/prebuildAppAsync.ts:90:21)
[stderr]     at actionAsync (/build/node_modules/expo-cli/src/commands/eject/prebuildAsync.ts:34:3)
node exited with non-zero code: 1

I don’t have problems with iOS build.
I tried to recreate iOS and Android folder’s and I have the same problem.
I don’t have the problem when I build my project with Android Studio.
Could you help me to resolve this issue ?

My project is an Expo Bare with SDK 44.
Please find my config :

{
  "main": "index.js",
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "web": "expo start --web",
    "start": "expo start --dev-client",
    "test": "jest"
  },
  "dependencies": {
    "@config-plugins/react-native-google-cast": "^0.1.0",
    "@expo/webpack-config": "~0.16.2",
    "@react-native-async-storage/async-storage": "~1.15.0",
    "@react-native-community/netinfo": "7.1.3",
    "@react-native-community/slider": "4.1.12",
    "@react-navigation/bottom-tabs": "^5.11.8",
    "@react-navigation/material-top-tabs": "^5.3.14",
    "@react-navigation/native": "^6.0.4",
    "@react-navigation/stack": "^5.14.5",
    "axios": "^0.21.1",
    "device": "^0.3.12",
    "eas-cli": "^0.41.0",
    "expo": "^44.0.0",
    "expo-av": "~10.2.0",
    "expo-blur": "~11.0.0",
    "expo-crypto": "~10.1.1",
    "expo-device": "~4.1.0",
    "expo-keep-awake": "~10.0.1",
    "expo-linear-gradient": "~11.0.0",
    "expo-navigation-bar": "~1.1.1",
    "expo-notifications": "~0.14.0",
    "expo-permissions": "~13.1.0",
    "expo-screen-orientation": "~4.1.1",
    "expo-sharing": "~10.1.0",
    "expo-splash-screen": "~0.14.1",
    "expo-status-bar": "~1.2.0",
    "expo-updates": "~0.11.3",
    "expo-video-player": "^1.6.1",
    "lottie-ios": "^3.2.3",
    "lottie-react-native": "5.0.1",
    "moment": "^2.29.1",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-native": "0.64.3",
    "react-native-airplay-button": "^1.0.4",
    "react-native-animatable": "^1.3.3",
    "react-native-dom": "^0.5.0",
    "react-native-gesture-handler": "~2.1.0",
    "react-native-google-cast": "^4.1.2",
    "react-native-paper": "^4.7.2",
    "react-native-reanimated": "~2.3.1",
    "react-native-reanimated-slider": "^1.0.6",
    "react-native-safe-area-context": "3.3.2",
    "react-native-screens": "~3.10.1",
    "react-native-snap-carousel": "4.0.0-beta.6",
    "react-native-tab-view": "^2.15.2",
    "react-native-video": "^5.1.1",
    "react-native-web": "0.17.1",
    "react-navigation": "^4.4.4",
    "react-navigation-stack": "^2.10.4",
    "react-redux": "^7.2.2",
    "redux": "^4.0.5",
    "sudo": "^1.0.3"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@expo/next-adapter": "^2.1.65",
    "babel-jest": "~25.2.6",
    "jest": "^26.6.3",
    "react-test-renderer": "~16.13.1"
  },
  "jest": {
    "preset": "react-native"
  },
  "private": true,
  "name": "sofavod",
  "version": "1.0.0"
}

Thanks you for your help,
Kind regards,
Kévin

if you have a bare project you should not be running expo prebuild and EAS Build will not run this for bare projects. are you not committing your android directory to git?

Thanks for your back !
I use a .gitignore for my Andoird folder :

# Android
*.apk
*.hprof
/android/**/build
/android/**/.cxx
/android/**/local.properties
/android/captures
/android/expoview/libs/ReactAndroid-temp
/android/versioned-react-native/ReactAndroid
ReactAndroid-temp.aar

It’s correct ?

Maybe I’m dumb, but I thought on a bare project you would generate ios and android folders by running expo prebuild, and EAS servers run this on bare projects…? That said, KevinGraillot’s build seems to be managed? Regardless, I weirdly had this same error (on a bare project) and commented the manifest file in my gitignore, which fixed things. Super confused, but if anyone else lands here that’s what worked for me.

If you have a bare project eas builds it as it is, if you have managed project we will run prebuild on worker and build the result. If you getting that error in eas that means that there is sth missing and your project is not detected as bare, we detect workflow based on whether app/src/main/AndroidManifest.xml exists(and is gitignored or not)

commented the manifest file in my gitignore

Why would you have AndroidManifest.xml in the gitignore? This file should be committed to the repo
If you want to have managed project you should gitingore entire android directory not just manifest file.

Based on your build history:

  • your last android build (successful one) was a bare project
  • your second to last (failed) was managed, but the android directory already existed, so it interfered with the prebuild command