gpt4 book ai didi

android - Firebase/Fabric Crashlytics 和 Proguard/R8

转载 作者:行者123 更新时间:2023-12-05 08:06:43 26 4
gpt4 key购买 nike

我有一个项目已从 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

如果我在没有签名/proguarding 的情况下运行应用程序,则会按预期收到崩溃(使用 Crashlytics.getInstance().crash() 强制崩溃)。

还有一点奇怪的是,当使用 Crashlytics.getInstance().crash() 强制 proguarded 构建崩溃时,而不是崩溃并显示标准的 android 弹出窗口说应用程序关闭后,应用程序卡住并坐在那里什么都不做,除非我强行关闭它。

在打开 Firebase Crashlytics 登录 adb 并查看日志(使用命令 adb logcat -s Fabric CrashlyticsCore)后,我只看到了 proguarded 构建:

--------- 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.

我现在不知道还有什么问题,因为自问题开始以来,关于混淆器的任何内容都没有改变。有谁知道这可能不起作用的任何其他原因以及如何解决这些问题?

最佳答案

R8 生成一个 mapping.txt 文件,该文件有助于回溯每个构建的堆栈跟踪。该文件位于以下路径:

app\build\outputs\mapping\{build-variant}\mapping.txt

如果您使用应用程序包上传您的应用程序,则默认包含映射文件。否则,您可以在 Playstore 中手动上传 mapping.txt。

您应该将以下这些规则添加到 progaurd-rules.pro 以支持回溯:

-keepattributes LineNumberTable,SourceFile
-renamesourcefileattribute SourceFile

更多详细信息,请参阅:

关于android - Firebase/Fabric Crashlytics 和 Proguard/R8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59210312/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com