Expo 51构建Android生产APK真机闪屏后崩溃求助
Expo SDK 51构建生产APK真机启动闪屏崩溃求助
我使用Expo SDK 51执行eas build -p android --profile production命令构建生产版APK,构建过程无异常,但将APK安装到安卓真机后,启动时仅显示闪屏随即崩溃。模拟器与Expo Go环境下运行均正常。
我将真机连接电脑后,执行以下步骤重试,问题仍未解决:
1. eas build -p android --profile production --clear-cache 2. adb install -r MyApp.apk 3. adb logcat
从Logcat日志中捕获到以下异常信息:
06-18 15:16:23.359 1455 3526 W WindowManager: Exception thrown during dispatchAppVisibility Window{b491ce8 u0 com.myApp.MyApp/com.myApp.MyApp.MainActivity EXITING} 06-18 15:35:37.566 1455 1567 W PackageManager: java.lang.IllegalArgumentException: Unable to get package com.myApp.MyApp 06-18 15:35:38.323 18370 18370 W Finsky : [2] aegq.b(126): STU: Failed to get storage stats for package 'com.myApp.MyApp' (1601: Error getting stats: android.content.pm.PackageManager.NameNotFoundException) 06-18 15:57:18.002 25857 25946 W GOS:PackageUtil: isPackageInstalledAsUser(). Exception: android.content.pm.PackageManager$NameNotFoundException: com.myApp.MyApp 06-18 15:57:53.221 1455 2981 W WindowManager: Exception thrown during dispatchAppVisibility Window{1ccb0a5 u0 com.myApp.MyApp/com.myApp.MyApp.MainActivity EXITING} 06-18 15:58:02.730 1455 6310 E AppOps : java.lang.SecurityException: Specified package "com.myApp.MyApp" under uid -1 but it is not 06-18 16:06:54.320 26999 26999 E AppButtonsPrefCtl: Exception when retrieving package:com.myApp.MyApp 06-18 16:06:54.320 26999 26999 E AppButtonsPrefCtl: android.content.pm.PackageManager$NameNotFoundException: com.myApp.MyApp 06-18 16:06:54.537 18370 18612 W ResourcesManager: java.io.IOException: Failed to load asset path /data/app/~~DvIivdyMBKmqze5UOR38yA==/com.myApp.MyApp-djdb_-FbcxNuzhRd3BN9Dw==/base.apk
以下是我的项目配置文件,恳请各位提供指导或解决方案:
app.json
{ "expo": { "name": "MyApp", "slug": "MyApp", "platforms": [ "ios", "android" ], "version": "1.0.0", "orientation": "portrait", "icon": "./assets/images/icon.png", "scheme": "myapp", "userInterfaceStyle": "automatic", "splash": { "image": "./assets/images/splash.png", "resizeMode": "contain", "backgroundColor": "#ffffff" }, "assetBundlePatterns": [ "**/*" ], "ios": { "supportsTablet": true, "bundleIdentifier": "com.myApp.MyApp", "buildNumber": "1.0.0" }, "android": { "adaptiveIcon": { "foregroundImage": "./assets/images/icon.png", "backgroundColor": "#ffffff" }, "package": "com.myApp.MyApp", "versionCode": 1 }, "web": { "bundler": "metro", "output": "static", "favicon": "./assets/images/favicon.png" }, "plugins": [ "expo-router", "expo-font" ], "experiments": { "typedRoutes": true, "tsconfigPaths": true }, "extra": { "router": { "origin": false }, "eas": { "projectId": "xxxx-xxxx-xxxx-xxxx-xxxx" } } } }
eas.json
{ "cli": { "version": ">= 9.2.0" }, "build": { "development": { "developmentClient": true, "distribution": "internal" }, "preview": { "distribution": "internal" }, "production": { "android": { "buildType": "apk" } } }, "submit": { "production": {} } }
package.json
{ "name": "myApp", "main": "expo-router/entry", "version": "1.0.0", "scripts": { "start": "expo start", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web", "test": "jest --watchAll" }, "jest": { "preset": "jest-expo" }, "dependencies": { "@expo/vector-icons": "^14.0.0", "@react-native-async-storage/async-storage": "1.23.1", "@react-native-community/datetimepicker": "8.0.1", "@react-native-picker/picker": "2.7.5", "@react-navigation/native": "^6.0.2", "@supabase/supabase-js": "^2.43.1", "@tanstack/react-query": "^5.36.0", "expo": "^51.0.14", "expo-constants": "~16.0.2", "expo-device": "~6.0.2", "expo-font": "~12.0.7", "expo-linking": "~6.3.1", "expo-notifications": "~0.28.9", "expo-router": "~3.5.16", "expo-splash-screen": "~0.27.5", "expo-status-bar": "~1.12.1", "expo-system-ui": "~3.0.6", "expo-web-browser": "~13.0.3", "react": "18.2.0", "react-dom": "18.2.0", "react-hook-form": "^7.51.3", "react-native": "0.74.2", "react-native-elements": "^3.4.3", "react-native-modal-datetime-picker": "^17.1.0", "react-native-safe-area-context": "4.10.1", "react-native-screens": "3.31.1", "react-native-select-dropdown": "^4.0.1", "react-native-url-polyfill": "^2.0.0", "react-native-web": "~0.19.6" }, "devDependencies": { "@babel/core": "^7.20.0", "@types/react": "~18.2.45", "jest": "^29.2.1", "jest-expo": "~51.0.1", "react-test-renderer": "18.2.0", "typescript": "~5.3.3" }, "private": true }
内容的提问来源于stack exchange,提问作者Koreahn
相关产品推荐
相关产品推荐

