APK errors

expo prebuild error

Error text

Error: [android.dangerous]: withAndroidDangerousBaseMod: Cannot read properties of undefined
Prebuild failed. Config plugin error.

Cause

prebuild breaks while running the plugins from app.json. Usually a plugin option is wrong or its version does not match the SDK.

Step-by-step fix

  1. Find the plugin name in the error and compare app.json with that plugin's options.
  2. Fix mismatched packages with npx expo install --check.
  3. Delete the android and ios folders and run npx expo prebuild --clean.
  4. Switch plugins off one by one to find the culprit.
  5. Check the JSON syntax of app.json; even a trailing comma causes this.

Example commands

npx expo prebuild --clean --platform android
npx expo config --type introspect
npx expo install --check

How to prevent it

Do not commit native folders; regenerate them with prebuild every time.

Author and license: Nibras Code