我有一个项目,我已从 Fabric 迁移到 firebase Crashlytics。这一切最初都很好,我按预期收到了 Firebase 的崩溃报告。在过去的几个月里,Firebase 不再显示任何崩溃报告,而 Fabric 仍然显示。
应用程序构建过程当前使用 R8,但我也尝试使用 Proguard 和 R8 Full Mode 无济于事。
我检查了 Proguard 的配置,并在 proguard 规则文件中得到了我认为正确的规则:
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**
-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception
如果我在未签名/保护它的情况下运行应用程序,则会按预期收到崩溃(使用强制崩溃Crashlytics.getInstance().crash()
)。
其他奇怪的事情是,当使用 强制保护的构建崩溃时Crashlytics.getInstance().crash()
,而不是崩溃并显示标准的 android 弹出窗口说应用程序已关闭,应用程序反而冻结并坐在那里什么都不做,除非我强制关闭它。
打开 Firebase Crashlytics 登录adb
并查看日志(使用命令adb logcat -s Fabric CrashlyticsCore
)后,我只看到了经过保护的构建:
--------- beginning of main
--------- beginning of system
--------- beginning of crash
与非防护版本的以下内容相比:
--------- beginning of main
--------- beginning of system
12-06 09:24:03.055 20894 20894 D Fabric : Build ID is: {REPLACED}
12-06 09:24:03.056 20894 20894 I CrashlyticsCore: Initializing Crashlytics Core 2.7.0.33
12-06 09:24:03.092 20894 20894 D CrashlyticsCore: Exception handling initialization successful
12-06 09:24:03.093 20894 20894 D Fabric : Initializing io.fabric.sdk.android:fabric [Version: 1.4.8.32], with the following kits:
12-06 09:24:03.093 20894 20894 D Fabric : com.crashlytics.sdk.android:crashlytics [Version: 2.10.1.34]
12-06 09:24:03.093 20894 20894 D Fabric : com.crashlytics.sdk.android:answers [Version: 1.4.7.32]
12-06 09:24:03.093 20894 20894 D Fabric : com.crashlytics.sdk.android:beta [Version: 1.2.10.27]
12-06 09:24:03.093 20894 20894 D Fabric : com.crashlytics.sdk.android.crashlytics-core [Version: 2.7.0.33]
12-06 09:24:03.093 20894 20894 D Fabric :
12-06 09:24:04.605 20894 21000 D Fabric : Using AdvertisingInfo from Reflection Provider
12-06 09:24:04.660 20894 20988 D Fabric : Build ID is: {REPLACED}
12-06 09:24:04.672 20894 21003 D CrashlyticsCore: Opening a new session with ID {REPLACED}
12-06 09:24:04.678 20894 21000 D Fabric : Build ID is: {REPLACED}
12-06 09:24:04.706 20894 20988 D Fabric : Build ID is: {REPLACED}
12-06 09:24:04.736 20894 20988 D Fabric : Requesting settings from https://settings.crashlytics.com/spi/v2/platforms/android/apps/{REPLACED}
12-06 09:24:04.741 20894 20988 D Fabric : Settings query params were: {instance=e6199970543402496ab15ac231f04e89dc42dea5, build_version=6128, display_version=6.3.0, source=1, icon_hash=7d8e21c0bbb767a8faeff7b75b8eb0db7aa90aa8}
12-06 09:24:05.476 20894 20988 D Fabric : Settings result was: 200
12-06 09:24:05.494 20894 20988 D Fabric : Settings request ID: null
12-06 09:24:05.502 20894 20988 D Fabric : Writing settings to cache file...
12-06 09:24:05.517 20894 20988 D Fabric : Loaded settings: {"settings_version":2,"cache_duration":86400,"features":{"collect_logged_exceptions":true,"collect_reports":true,"collect_analytics":true,"push_enabled":true,"firebase_crashlytics_enabled":true},"analytics":{"url":"https:\/\/e.crashlytics.com\/spi\/v2\/events","flush_interval_secs":120,"max_file_count_per_send":1,"track_custom_events":true,"track_predefined_events":true,"flush_on_background":true,"max_byte_size_per_file":40000,"max_pending_send_file_count":20,"sampling_rate":1,"forward_to_google_analytics":true},"beta":{"update_suspend_duration":1209600},"app":{"identifier":"com.hermes.induction.dev","status":"activated","url":"https:\/\/api.crashlytics.com\/spi\/v1\/platforms\/android\/apps\/{REPLACED}","reports_url":"https:\/\/reports.crashlytics.com\/spi\/v1\/platforms\/android\/apps\/{REPLACED}\/reports","ndk_reports_url":"https:\/\/reports.crashlytics.com\/sdk-api\/v1\/platforms\/android\/apps\/{REPLACED}\/minidumps","update_required":true},"session":{"log_buffer_size":64000,"max_chained_exception_depth":16,"max_complete_sessions_count":4,"max_custom_exception_events":8,"max_custom_key_value_pairs":64,"identifier_mask":255},"prompt":{"title":"Send Crash Report?","message":"Looks like we crashed! Please help us fix the problem by sending a crash report.","send_button_title":"Send","show_cancel_button":true,"cancel_button_title":"Don't Send","show_always_send_button":true,"always_send_button_title":"Always Send"},"expires_at":1575710645499}
12-06 09:24:05.520 20894 20988 D Fabric : Build ID is: {REPLACED}
12-06 09:24:05.521 20894 20988 D Fabric : Server says an update is required - forcing a full App update.
12-06 09:24:05.522 20894 20988 D Fabric : App icon resource ID is 2131230980
12-06 09:24:05.527 20894 20988 D Fabric : Build ID is: {REPLACED}
12-06 09:24:06.149 20894 20988 D Fabric : Sending app info to https://api.crashlytics.com/spi/v1/platforms/android/apps/{REPLACED}
12-06 09:24:06.150 20894 20988 D Fabric : App icon hash is 7d8e21c0bbb767a8faeff7b75b8eb0db7aa90aa8
12-06 09:24:06.150 20894 20988 D Fabric : App icon size is 288x288
12-06 09:24:06.407 20894 20988 D Fabric : Update app request ID: d5c5155cd486e93aee14e51526dc7399
12-06 09:24:06.407 20894 20988 D Fabric : Result was 204
12-06 09:24:06.412 20894 21003 D CrashlyticsCore: Initialization marker file created.
12-06 09:24:06.422 20894 20988 D CrashlyticsCore: Registered Firebase Analytics event listener for breadcrumbs: true
12-06 09:24:06.423 20894 21003 D CrashlyticsCore: Finalizing previously open sessions.
12-06 09:24:06.436 20894 21003 D CrashlyticsCore: No open sessions to be closed.
12-06 09:24:06.436 20894 21003 D CrashlyticsCore: Closed all previously open sessions
12-06 09:24:06.441 20894 21247 D CrashlyticsCore: Starting report processing in 1.0 second(s)...
12-06 09:24:06.448 20894 21003 D CrashlyticsCore: Initialization marker file removed: true
12-06 09:24:07.441 20894 21247 D CrashlyticsCore: Checking for crash reports...
12-06 09:24:07.445 20894 21247 D CrashlyticsCore: No reports found.
我现在不知道还有什么问题,因为自从问题开始以来,关于 proguard 的任何内容都没有改变。有谁知道这可能不起作用的任何其他原因以及如何解决它们?