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

Posted

技术标签:

【中文标题】在模拟器上启动后立即反应本机应用程序崩溃【英文标题】:React native app crash immediately after launch on emulator 【发布时间】:2021-04-11 04:56:27 【问题描述】:

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

    世博会:40.0.0; 反应:17.0.1; 反应原生:0.63.4; 等级:6.7.1; 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 ActivityRecordec93219 u0 dr.vurp/.MainActivity t-1 f

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

【问题讨论】:

您已添加标签 Google Play 服务。默认模拟器没有安装,请确保已添加。 @Blundell 我正在使用安装了 Google Play 服务的模拟器。但我也在我的 build.gradle 文件中调用了 maven google()。 【参考方案1】:

我解决了更新我的主要 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 "+"
            
        
    


【讨论】:

以上是关于在模拟器上启动后立即反应本机应用程序崩溃的主要内容,如果未能解决你的问题,请参考以下文章

iPhone应用程序更新后立即崩溃

应用程序在启动时立即崩溃,仅在设备上

更新到 Xcode 11.0 后反应本机崩溃

反应原生应用程序在启动时在设备中崩溃。在模拟器中工作正常

为啥 Kivy apk 在 android 设备上启动 apk 后立即崩溃

使用全局函数启动后立即崩溃