我迁移到了Firebase Crashlytics SDK。调试应用程序工作正常,Crashlytics被初始化,当发生崩溃时,重新启动应用程序后将其上传到https://crashlyticsreports-pa.googleapis.com。
但是,当我创建一个发布版apk时,Crashlytics确实被初始化,但日志没有被上传。
我使用的是com.google.firebase:firebase-crashlytics-gradle:2.3.0
一些调试后的日志:
10-14 17:47:42.803 10335 10723 D FirebaseCrashlytics: Executing shutdown hook for Crashlytics Exception Handler
10-14 17:47:42.804 10335 10724 D FirebaseCrashlytics: Executing shutdown hook for com.google.firebase.crashlytics.startup
10-14 17:47:42.808 10335 10725 D FirebaseCrashlytics: Executing shutdown hook for awaitEvenIfOnMainThread task continuation executor
10-14 17:47:50.523 10755 10755 D FirebaseCrashlytics: Crashlytics automatic data collection ENABLED by API.
10-14 17:47:50.523 10755 10755 D FirebaseCrashlytics: Firebase Analytics is available.
10-14 17:47:50.523 10755 10755 D FirebaseCrashlytics: Firebase Analytics listener registered successfully.
10-14 17:47:50.534 10755 10755 D FirebaseCrashlytics: Reading cached settings...
10-14 17:47:50.536 10755 10755 D FirebaseCrashlytics: Loaded cached settings: {"settings_version":3,"cache_duration":86400,"features":{"collect_logged_exceptions":true,"collect_reports":true,"collect_analytics":false,"prompt_enabled":false,"push_enabled":false,"firebase_crashlytics_enabled":false},"app":{"status":"activated","update_required":false,"report_upload_variant":2,"native_report_upload_variant":2},"fabric":{"org_id":"593f7256d634338f7a00010e","bundle_id":"com.myapp"},"expires_at":1602742343631}
10-14 17:47:50.536 10755 10755 D FirebaseCrashlytics: Returning cached settings.
10-14 17:47:50.537 10755 10755 D FirebaseCrashlytics: Mapping file ID is: 3f921f2e662f4b19a04a74d134464115d
10-14 17:47:50.537 10755 10755 I FirebaseCrashlytics: Initializing Crashlytics 17.2.2
10-14 17:47:50.538 10755 10755 D FirebaseCrashlytics: Installer package name is: null
10-14 17:47:50.564 10755 10755 D FirebaseCrashlytics: Exception handling initialization successful
10-14 17:47:50.607 10755 10782 D FirebaseCrashlytics: Found matching FID, using Crashlytics IID: 9b68e8c3d603455d8296cfe9e85d2de7
10-14 17:47:50.607 10755 10782 D FirebaseCrashlytics: Opening a new session with ID 5F869F160238-0001-2A03-9234AE8E16EA
10-14 17:47:50.621 10755 10782 D FirebaseCrashlytics: Initialization marker file created.
10-14 17:47:50.622 10755 10782 D FirebaseCrashlytics: Registered Firebase Analytics event receiver for breadcrumbs
10-14 17:47:50.622 10755 10782 D FirebaseCrashlytics: Finalizing previously open sessions.
10-14 17:47:50.625 10755 10782 D FirebaseCrashlytics: Closing open sessions.
10-14 17:47:50.625 10755 10782 D FirebaseCrashlytics: Closing session: 5F8697A600BB-0001-285F-9234AE8E16EA
10-14 17:47:50.625 10755 10782 D FirebaseCrashlytics: Collecting session parts for ID 5F8697A600BB-0001-285F-9234AE8E16EA
10-14 17:47:50.625 10755 10782 D FirebaseCrashlytics: Session 5F8697A600BB-0001-285F-9234AE8E16EA has fatal exception: false
10-14 17:47:50.625 10755 10782 D FirebaseCrashlytics: Session 5F8697A600BB-0001-285F-9234AE8E16EA has non-fatal exceptions: false
10-14 17:47:50.625 10755 10782 D FirebaseCrashlytics: No events present for session ID 5F8697A600BB-0001-285F-9234AE8E16EA
10-14 17:47:50.625 10755 10782 D FirebaseCrashlytics: Removing session part files for ID 5F8697A600BB-0001-285F-9234AE8E16EA
10-14 17:47:50.629 10755 10782 D FirebaseCrashlytics: Finalizing report for session 5F8697A600BB0001285F9234AE8E16EA
10-14 17:47:50.630 10755 10782 D FirebaseCrashlytics: Session 5F8697A600BB0001285F9234AE8E16EA has no events.
10-14 17:47:50.631 10755 10782 D FirebaseCrashlytics: Closed all previously open sessions
10-14 17:47:50.631 10755 10782 D FirebaseCrashlytics: No reports are available.
10-14 17:47:50.631 10755 10782 D FirebaseCrashlytics: Initialization marker file removed: true
10-14 17:47:50.688 10755 10755 D FirebaseCrashlytics: Crashlytics automatic data collection ENABLED by API.
当我使用启用日志的调试应用程序时,我看到了我所调用的崩溃。但在运行发布版apk时没有看到。
10-14 18:04:14.162 11202 11202 D FirebaseCrashlytics: Crashlytics is handling uncaught exception "java.lang.RuntimeException: Testing....." from thread main
经过大量调试,我发现如果我有以下内容:
Thread.setDefaultUncaughtExceptionHandler(new CrashHandler());
那么崩溃信息并没有被报告到Firebase。然而,使用Fabric却可以正常工作。你有任何想法如何处理这个问题吗?