在模拟器上启动后立即反应本机应用程序崩溃

React native app crash immediately after launch on emulator

我有一个带有这些插件版本的 EXPO 裸 REACT NATIVE 应用程序:

  1. 世博会:40.0.0;
  2. 反应:17.0.1;
  3. 本机反应:0.63.4;
  4. gradle:6.7.1;
  5. com.android.tools.build:gradle:4.0.1;

我正在使用 Android SDK 29。

我能够为 ANDROID 构建应用程序,但是当我使用午餐时应用程序立即崩溃,我可以看到以下错误日志:

01-05 13:01:08.477  2019  2059 I PackageManager: Un-granting permission android.permission.SYSTEM_ALERT_WINDOW from package dr.vurp (protectionLevel=1250 flags=0x3808be46)
01-05 13:01:08.532  2019  2059 V BackupManagerService: restoreAtInstall pkg=dr.vurp token=1 restoreSet=0
01-05 13:01:08.535  2019  2059 I PackageManager: Un-granting permission android.permission.SYSTEM_ALERT_WINDOW from package dr.vurp (protectionLevel=1250 flags=0x3808be46)
01-05 13:01:08.658  2164  6364 W GCM     : Unexpected forwarded intent: Intent { act=android.intent.action.PACKAGE_ADDED dat=package:dr.vurp flg=0x4000010 cmp=com.google.android.gms/.chimera.PersistentIntentOperationService (has extras) }
01-05 13:01:08.660  2164  6364 W GCM     : Unexpected forwarded intent: Intent { act=android.intent.action.PACKAGE_ADDED dat=package:dr.vurp flg=0x4000010 cmp=com.google.android.gms/.chimera.PersistentIntentOperationService (has extras) }
01-05 13:01:08.724  2476  6372 I ChromeSync: [Sync,SyncIntentOperation] Handling the intent: Intent { act=android.intent.action.PACKAGE_ADDED dat=package:dr.vurp flg=0x4000010 cmp=com.google.android.gms/.chimera.GmsIntentOperationService (has extras) }.
01-05 13:01:08.831  2476  6372 I ChromeSync: [Persistence,AffiliationManager] One of affiliation or grouping data for android://kmwFUO2u567RIRuR_eBr5MxHSOYdjxr74L0S85SaDQmhz0MGxy5mYq5Me4rnpXOoHX5S5bYSRETq-PQT5rH6aQ==@dr.vurp/ was not found. Marking affiliation data as stale...
01-05 13:01:09.003  2019  2556 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:dr.vurp flg=0x4000010 (has extras) } to com.google.android.packageinstaller/com.android.packageinstaller.PackageInstalledReceiver
01-05 13:01:09.004  2019  2047 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:dr.vurp flg=0x4000010 (has extras) } to com.android.musicfx/.Compatibility$Receiver
01-05 13:01:09.004  2019  2047 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:dr.vurp flg=0x4000010 (has extras) } to com.google.android.gms/.games.chimera.GamesSystemBroadcastReceiverProxy
01-05 13:01:09.004  2019  2047 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:dr.vurp flg=0x4000010 (has extras) } to com.google.android.gms/.gass.chimera.PackageChangeBroadcastReceiver
01-05 13:01:09.004  2019  2047 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:dr.vurp flg=0x4000010 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
01-05 13:01:09.004  2019  2047 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:dr.vurp flg=0x4000010 (has extras) } to com.google.android.googlequicksearchbox/com.google.android.apps.gsa.googlequicksearchbox.GelStubAppWatcher
01-05 13:01:09.004  2019  2047 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:dr.vurp flg=0x4000010 (has extras) } to com.google.android.ims/.receivers.RcsAutoStartReceiver
01-05 13:01:09.273  2019  3232 I ActivityTaskManager: START u0 {flg=0x10000000 cmp=dr.vurp/.MainActivity} from uid 2000
01-05 13:01:09.377  6469  6469 I dr.vurp : Not late-enabling -Xcheck:jni (already on)
01-05 13:01:09.415  2019  2048 I ActivityManager: Start proc 6469:dr.vurp/u0a133 for activity {dr.vurp/dr.vurp.MainActivity}
01-05 13:01:09.455  6469  6469 E dr.vurp : Unknown bits set in runtime_flags: 0x8000
01-05 13:01:09.456  6469  6469 W dr.vurp : Unexpected CPU variant for X86 using defaults: x86
01-05 13:01:10.238  6469  6469 E AndroidRuntime: Process: dr.vurp, PID: 6469
01-05 13:01:10.238  6469  6469 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/data/app/dr.vurp-i_QM0MByY5Q55yWBpd18MA==/base.apk"],nativeLibraryDirectories=[/data/app/dr.vurp-i_QM0MByY5Q55yWBpd18MA==/lib/x86, /data/app/dr.vurp-i_QM0MByY5Q55yWBpd18MA==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
01-05 13:01:10.253  2019  2556 W ActivityTaskManager:   Force finishing activity dr.vurp/.MainActivity
01-05 13:01:10.324  2019  2556 I ActivityManager: Process dr.vurp (pid 6469) has died: vis+99 TOP 
01-05 13:01:10.755  2019  2041 W ActivityTaskManager: Activity top resumed state loss timeout for ActivityRecord{ec93219 u0 dr.vurp/.MainActivity t-1 f}

原因好像是:java.lang.ClassNotFoundException: 没找到class“com.google.android.gms.common.internal.zzbq”,但不知道为什么!

我解决了更新主 build.gradle 文件的问题。我添加了子项目部分

allprojects {
repositories {
   //...
}
subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.google.android.gms'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "+"
            }

            if (details.requested.group == 'com.google.firebase'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "+"
            }
        }
    }
}
}