Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to report crashes using the new Firebase Crashlytics? #3

Closed
Thomas-Vos opened this issue Apr 14, 2020 · 8 comments · Fixed by #7
Closed

How to report crashes using the new Firebase Crashlytics? #3

Thomas-Vos opened this issue Apr 14, 2020 · 8 comments · Fixed by #7

Comments

@Thomas-Vos
Copy link
Contributor

In the new version of Firebase Crashlytics the function recordCustomExceptionName:reason:frameArray: is replaced by recordError.

See the following: https://firebase.google.com/docs/crashlytics/upgrade-sdk?platform=ios#recordcustomexceptionnamereasonframearray_is_replaced_by_recorderror

The alternative appears to be one of the following:

The ExceptionModel can be created using a name, reason, and stackTrace. This looks like the way to go but I cannot find a way to create a StackFrame using an address. The StackFrame only has a constructor for symbol, file, and line. Any ideas how to report the exception to Firebase now?

@Thomas-Vos
Copy link
Contributor Author

Related: firebase/firebase-ios-sdk#5182

@jiehu5114
Copy link

mark

@Thomas-Vos
Copy link
Contributor Author

Firebase 6.32.0 fixes this issue:

class CrashlyticsCrashHandler: CrashkiosCrashHandler {
    override func crashParts(
        addresses: [KotlinLong],
        exceptionType: String,
        message: String
    ) {
        let exceptionModel = ExceptionModel(name: exceptionType, reason: message)
        exceptionModel.stackTrace = addresses.map {
            StackFrame(address: UInt(truncating: $0))
        }
        Crashlytics.crashlytics().record(exceptionModel: exceptionModel)
    }
}

@matteobianchi3
Copy link

matteobianchi3 commented Sep 10, 2020

I've tried it but I get a "(Missing)" label instead of the correct "file + line" label related to an exception raised from the Kotlin/Native "shared" framework, and I'm quite confident that the related dSYMs have been correctly uploaded to Firebase Crashlytics; any idea?

@Thomas-Vos
Copy link
Contributor Author

@matteobianchi3 Did you upload the dSYMs from App Store Connect as well (if you are using bitcode)?

@matteobianchi3
Copy link

I have bitcode disabled.
I've now added this script at the end of the build phases

# validation
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -val -gsp "${PROJECT_DIR}/${PROJECT}/GoogleService-Info.plist" -p ios -- "${DWARF_DSYM_FOLDER_PATH}"

# background upload
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/${PROJECT}/GoogleService-Info.plist" -p ios -- "${DWARF_DSYM_FOLDER_PATH}" > /dev/null 2>&1 &

and Crashlytics seems to be able to symbolicate custom Kotlin exception reports.

Using the simple "official" Crashlytics script "${PODS_ROOT}/FirebaseCrashlytics/run" doesn't work since it only uploads the app's dSYM and not the framework's one.

Does all of this make sense to you?

@Thomas-Vos
Copy link
Contributor Author

Looks all right I think, it is similar to what is mentioned in the CrashKiOS readme: https://github.com/touchlab/CrashKiOS#upload-dsyms-to-crashlytics

I have the script that is mentioned in the readme in my project as well.

@kpgalligan
Copy link
Contributor

closing this for now. We have explicit support in Kermit for adding Crashllytics. You don't have to use it but can see how we do it there.

https://github.com/touchlab/Kermit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants