最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Expo SDK 51 - App crashes after splash screen on iOS and Android (EAS build, react-native-google-mobile-ads, useFrameworks) - St

programmeradmin4浏览0评论

I'm using Expo SDK 51 with `react-native-google-mobile-ads` and `expo-build-properties`.

After building with `eas build --profile development --platform ios/android`, the app installs correctly on the simulator, but **crashes immediately after showing the splash screen**.
On physical devices, the app either fails to install or crashes instantly.

---

### Behavior Summary

- **Case 1:** Defined `expo-splash-screen` inside `plugins` → App launches, shows splash image, then crashes
- **Case 2:** Moved splash config outside `plugins` block → App launches, crashes immediately (splash not shown)
- **console.log()` in App.js is never printed**

---

### Environment

- Expo SDK: 51.0.x
- React Native: 0.74.5
- Node: 18.20.1
- Expo Dev Client: enabled
- Using `eas secret` + `eas.json` for env vars

- System:
  OS: macOS 15.3.1
  Shell: 5.9 - /bin/zsh
- Binaries:
  Node: 18.20.7
  npm: 10.8.2
  Watchman: 2025.03.03.00
- npmPackages:
  expo: ~51.0.39
  react: 18.2.0
  react-native: 0.74.5
- npmGlobalPackages:
  eas-cli: 16.0.1
- Expo Workflow: bare

> ✅ Previously, the app worked perfectly using **Expo Go**, `[email protected]`, and no native plugins

---

### package.version


"react-native-google-mobile-ads": "^14.0.0",
"react-native-screens": "3.31.1",
"expo-build-properties": "~0.12.5"
"firebase": "^11.0.0",

app.json plugin setup


{
  "expo": {
    "name": “HelloWorld”,
    "slug": “HelloWorld”,
    "version": “x.x.x”,
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "userInterfaceStyle": "light",
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "company.HelloWorld”,
      "icon": "./assets/icon.png",
      "infoPlist": {
        "ITSAppUsesNonExemptEncryption": false
      }
    },
    "android": {
      "package": "company.HelloWorld",
      "adaptiveIcon": {
        "foregroundImage": "./assets/icon.png",
        "backgroundColor": “#ffffff”
      }
    },
    "web": {
      "favicon": "./assets/favoicon.png"
    },
    "plugins": [
      "expo-font",
      [
        "expo-splash-screen",
        {
          "backgroundColor": "#ffffff",
          "image": "./assets/splash.png",
          "imageWidth": 200
        }
      ],
      [
        "expo-build-properties",
        {
          "ios": {
            "useFrameworks": "static"
          }
        }
      ],
      [
        "react-native-google-mobile-ads",
        {
          "androidAppId": “xxxxxx”,
          "iosAppId": “xxxxxx”
        }
      ]
    ],
    "extra": {
      "eas": {
        "projectId": “xxxxxx”
      }
    }
  }
}

eas.json plugin setup


{
  "cli": {
    "version": ">= 13.3.0",
    "appVersionSource": "remote"
  },
  "build": {
    "development": {
      "distribution": "internal",
      "ios": {
        "simulator": true
      },
      "env": {
        "firebaseApiKey": "@FIREBASE_API_KEY",
        "firebaseAuthDomain": "@FIREBASE_AUTH_DOMAIN",
        "firebaseProjectId": "@FIREBASE_PROJECT_ID",
        "firebaseStorageBucket": "@FIREBASE_STORAGE_BUCKET",
        "firebaseMessagingSenderId": "@FIREBASE_MESSAGING_SENDER_ID",
        "firebaseAppId": "@FIREBASE_APP_ID"
      }
    },
    "preview": {
      "distribution": "internal"
    },
    "production": {
      "autoIncrement": true,
      "env": {
        "firebaseApiKey": "@FIREBASE_API_KEY",
        "firebaseAuthDomain": "@FIREBASE_AUTH_DOMAIN",
        "firebaseProjectId": "@FIREBASE_PROJECT_ID",
        "firebaseStorageBucket": "@FIREBASE_STORAGE_BUCKET",
        "firebaseMessagingSenderId": "@FIREBASE_MESSAGING_SENDER_ID",
        "firebaseAppId": "@FIREBASE_APP_ID"
      }
    }
  },
  "submit": {
    "production": {}
  }
}


Other Issues Encountered

  • Tried npx expo prebuild --clean to test native build without dev-client, but got pod install error:
Command `pod install` failed.
└─ Cause: Invalid `Podfile` file: undefined method `present?' for nil:NilClass.

#  from /ios/Podfile:38
#  -------------------------------------------
#  target 'AustraliaWHVGuide' do
>    use_expo_modules!
#    config = use_native_modules!
#  -------------------------------------------

  • However, using eas build --profile development --platform ios still succeeds

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论