React 本机应用程序卡在 Android 的“启动画面”中

React native app gets stuck in the “splash” on Android

在生成我的 React 应用程序的 apk 时,我尝试在 android 工作室模拟器和物理单元格 phone 中对其进行测试,但它卡在启动画面上, 所以它不再进入应用程序的主屏幕 作为开始,我首先加载了可以使用 facebook 登录的登录屏幕,但我决定直接进入应用程序的主屏幕,所以我评论了完整的登录代码。

这是启动应用程序时adb logcat的记录:

02-23 01:11:13.186  6321  6481 E ReactNativeJNI: logMarker RUN_JS_BUNDLE_END
02-23 01:11:13.187  6321  6481 I ReactNativeJS: Running "main" with {"initialProps":{"exp":{"lastErrors":[{"isFatal":true,"errorMessage":"API key not found.  Check that <meta-data android:name=\"com.google.android.geo.API_KEY\" android:value=\"your API key\"/> is in the <application> element of AndroidManifest.xml","exceptionId":-493654449}],"initialUri":"https://expo.io:443/@jorgeelgrande/Logar","manifest":{"iconUrl":"https://d1wp6m56sqw74a.cloudfront.net/~assets/d72959742b353dc507c62f21b3734543","releaseChannel":"default","hostUri":"exp.host/@jorgeelgrande/Logar","commitTime":"2021-02-21T19:30:39.910Z","releaseId":"e2236e68-d8f8-4100-bce7-aef81cdd7d40","orientation":"portrait","isVerified":true,"bundledAssets":[],"name":"Logar","locales":{},"id":"@jorgeelgrande/Logar","updates":{"fallbackToCacheTimeout":0},"scopeKey":"@jorgeelgrande/Logar","currentFullName":"@jorgeelgrande/Logar","version":"1.0.0","slug":"Logar","platforms":["ios","android","web"],"publishedTime":"2021-02-21T19:30:39.865Z","splash":{"resizeMode":"contain","backgroundColor":"#001269","image":"./assets/splash.png","imageUrl":"https://d1wp6m56sqw74a.cloudfront.net/~assets/39e2d0cf68e19da7ea99565f9410e43e"},"icon":"./assets/icon.png","sdkVersion":"40.0.0","revisionId":"1.0.0-r.We25zhDW_","dependencies":["@react-native-async-storage/async-storage","@react-native-community/masked-view","@react-navigation/bottom-tabs","@react-navigation/drawer","@react-navigation/native","@react-navigation/stack","expo","expo-status-bar","react","react-dom","react-native","react-native-elements","react-native-gesture-handler","react-native-maps","react-native-paper","react-native-reanimated","react-native-safe-area-context","react-native-screens","react-native-web"],"android":{"versionCode":1,"package":"com.constructoreslogar.Logar"},"bundleUrl":"https://d1wp6m56sqw74a.cloudfront.net/%40jorgeelgrande%2FLogar%2F1.0.0%2F3d192a2eaa4007a968b3358781a2c535-40.0.0-android.js"},"shell":true}},"rootTag":1}
02-23 01:11:13.358  6321  6482 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class versioned.host.exp.exponent.modules.api.components.maps.SizeReportingShadowNode
02-23 01:11:13.388  6321  6321 I t0      : Making Creator dynamically
02-23 01:11:13.392  6321  6321 I DynamiteModule: Considering local module com.google.android.gms.maps_dynamite:0 and remote module com.google.android.gms.maps_dynamite:201817000
02-23 01:11:13.392  6321  6321 I DynamiteModule: Selected remote version of com.google.android.gms.maps_dynamite, version >= 201817000
02-23 01:11:13.393  6321  6321 V DynamiteModule: Dynamite loader version >= 2, using loadModule2NoCrashUtils
02-23 01:11:13.394  6321  6321 W oreslogar.Loga: Unsupported class loader
02-23 01:11:13.425  6321  6321 W oreslogar.Loga: Unsupported class loader
02-23 01:11:13.425   538  4514 E system_server: Invalid class loader spec: =UnsupportedClassLoaderContext=
02-23 01:11:13.425   538  4514 E PackageDexUsage: Unsupported context?
02-23 01:11:13.461  6321  6321 I Google Maps Android API: Google Play services client version: 12451000
02-23 01:11:13.468  6321  6321 I Google Maps Android API: Google Play services package version: 201817022
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager: Caught exception
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager: java.lang.RuntimeException: API key not found.  Check that <meta-data android:name="com.google.android.geo.API_KEY" android:value="your API key"/> is in the <application> element of AndroidManifest.xml
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.google.maps.api.android.lib6.drd.p.b(:com.google.android.gms.dynamite_mapsdynamite@201817052@20.18.17 (040700-0):6)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.google.maps.api.android.lib6.auth.f.a(:com.google.android.gms.dynamite_mapsdynamite@201817052@20.18.17 (040700-0):1)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.google.android.gms.maps.internal.CreatorImpl.a(:com.google.android.gms.dynamite_mapsdynamite@201817052@20.18.17 (040700-0):20)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.google.android.gms.maps.internal.CreatorImpl.newMapViewDelegate(:com.google.android.gms.dynamite_mapsdynamite@201817052@20.18.17 (040700-0):2)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.google.android.gms.maps.internal.g.a(:com.google.android.gms.dynamite_mapsdynamite@201817052@20.18.17 (040700-0):18)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at cy.onTransact(:com.google.android.gms.dynamite_mapsdynamite@201817052@20.18.17 (040700-0):4)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at android.os.Binder.transact(Binder.java:1043)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at d.f.b.e.f.n.a.x3(Unknown Source:2)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.google.android.gms.maps.m.x0.h4(Unknown Source:4)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.google.android.gms.maps.e$b.a(Unknown Source:6)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at d.f.b.e.c.a.t(com.google.android.gms:play-services-base@@17.3.0:9)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at d.f.b.e.c.a.d(com.google.android.gms:play-services-base@@17.3.0:1)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.google.android.gms.maps.e.onCreate(Unknown Source:4)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at versioned.host.exp.exponent.modules.api.components.maps.AirMapView.<init>(AirMapView.java:24)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at versioned.host.exp.exponent.modules.api.components.maps.AirMapManager.createViewInstance(AirMapManager.java:2)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at versioned.host.exp.exponent.modules.api.components.maps.AirMapManager.createViewInstance(AirMapManager.java:1)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.facebook.react.uimanager.ViewManager.createViewInstance(ViewManager.java:1)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:2)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:4)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:2)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(UIViewOperationQueue.java:9)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:4)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:1)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:7)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback.doFrame(ChoreographerCompat.java:1)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:970)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at android.view.Choreographer.doCallbacks(Choreographer.java:796)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at android.view.Choreographer.doFrame(Choreographer.java:727)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at android.os.Handler.handleCallback(Handler.java:938)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at android.os.Handler.dispatchMessage(Handler.java:99)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at android.os.Looper.loop(Looper.java:223)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at android.app.ActivityThread.main(ActivityThread.java:7656)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at java.lang.reflect.Method.invoke(Native Method)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
02-23 01:11:13.484  6321  6321 E unknown:DisabledDevSupportManager:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
02-23 01:11:13.487  6321  6321 W System.err: java.lang.reflect.InvocationTargetException
02-23 01:11:13.487  6321  6321 W System.err:    at java.lang.reflect.Method.invoke(Native Method)
02-23 01:11:13.487  6321  6321 W System.err:    at com.facebook.react.bridge.DefaultNativeModuleCallExceptionHandler.handleException(DefaultNativeModuleCallExceptionHandler.java:4)
02-23 01:11:13.487  6321  6321 W System.err:    at com.facebook.react.devsupport.DisabledDevSupportManager.handleException(DisabledDevSupportManager.java:2)
02-23 01:11:13.487  6321  6321 W System.err:    at com.facebook.react.bridge.ReactContext.handleException(ReactContext.java:5)
02-23 01:11:13.488  6321  6321 W System.err:    at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:2)
02-23 01:11:13.488  6321  6321 W System.err:    at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:7)
02-23 01:11:13.488  6321  6321 W System.err:    at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback.doFrame(ChoreographerCompat.java:1)
02-23 01:11:13.488  6321  6321 W System.err:    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:970)
02-23 01:11:13.488  6321  6321 W System.err:    at android.view.Choreographer.doCallbacks(Choreographer.java:796)
02-23 01:11:13.488  6321  6321 W System.err:    at android.view.Choreographer.doFrame(Choreographer.java:727)
02-23 01:11:13.488  6321  6321 W System.err:    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
02-23 01:11:13.488  6321  6321 W System.err:    at android.os.Handler.handleCallback(Handler.java:938)
02-23 01:11:13.488  6321  6321 W System.err:    at android.os.Handler.dispatchMessage(Handler.java:99)
02-23 01:11:13.488  6321  6321 W System.err:    at android.os.Looper.loop(Looper.java:223)
02-23 01:11:13.488  6321  6321 W System.err:    at android.app.ActivityThread.main(ActivityThread.java:7656)
02-23 01:11:13.488  6321  6321 W System.err:    at java.lang.reflect.Method.invoke(Native Method)
02-23 01:11:13.488  6321  6321 W System.err:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
02-23 01:11:13.488  6321  6321 W System.err:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
02-23 01:11:13.488  6321  6321 W System.err: Caused by: com.facebook.react.common.JavascriptException: API key not found.  Check that <meta-data android:name="com.google.android.geo.API_KEY" android:value="your API key"/> is in the <application> element of AndroidManifest.xml
02-23 01:11:13.488  6321  6321 W System.err:    at host.exp.exponent.ReactNativeStaticHelpers.handleReactNativeError(ReactNativeStaticHelpers.java:2)
02-23 01:11:13.488  6321  6321 W System.err:    ... 18 more

似乎错误说出来了...

System.err: Caused by: com.facebook.react.common.JavascriptException: API key not found.  Check that <meta-data android:name="com.google.android.geo.API_KEY" android:value="your API key"/> is in the <application> element of AndroidManifest.xml

您可能需要将正确的密钥放在那里。