quickstart-unity
quickstart-unity copied to clipboard
[Bug] Crashlytics not sending crashes to the console when using *.tgz and UPM
[REQUIRED] Please fill in the following fields:
- Unity editor version: 2019.4.26f1
- Firebase Unity SDK version: 8.1.0
- Source you installed the SDK: UPM
- Problematic Firebase Component: Crashlytics
- Other Firebase Components in use: Core, Analytics
- Additional SDKs you are using: Facebook, AppLovin MaxSDK
- Platform you are using the Unity editor on: Mac
- Platform you are targeting: iOS
- Scripting Runtime: IL2CPP
[REQUIRED] Crashlytics not sending crashes to the console:
I wasn't sure where to add this issue. It seems to be specific to Unity when using iOS. Whenever including Crashlyitcs via UPM using *.tgz, Crashlytics does not seem to initialize properly and crashes will not get sent to the console. I've tried installing them via our custom registry as well directly in the project and it does not seem to make a difference.
Using the same GoogleService-Info.plist file, I've been able to send reports when using the *.unitypackage version of Crashlytics. I've removed my test *.plist for privacy purposes.
Steps to reproduce:
- Open attached project.
- Add the following tarball to the Packages folder: com.google.firebase.crashlytics-8.1.0.tgz, com.google.external-dependency-manager-1.2.166.tgz, com.google.firebase.analytics-8.1.0.tgz, com.google.firebase.app-8.1.0.tgz
- Add the GoogleService-info.plist to the Assets/* folder.
- Build for iOS
- Deploy to device. Crashes should happen automatically.
- Check the console and see no crashes. Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? What's the issue repro rate? 100%
What happened? How can we make the problem occur? No errors are reported to the Crashlytics dashboard.
If you have a downloadable sample project that reproduces the bug you're reporting, you will likely receive a faster response on your issue.
Hi @jamier-hh,
In order to identify what's causing this behvaior, could you provide the debug logs for your iOS build after enabling debug logging?
- Slightly edited game log: game-debug.log
- Repo-project log: repro-debug-logs.log
I've included both since for whatever reason, the repro-projects logs aren't as good. The game logs are edited to remove identifying information but nothing pertinent should have been removed.
Thanks for the additional information, @jamier-hh. Could you also verify if you're getting a similar result when using our quickstart?
Hmm very odd. It seems to be working with the quickstart.
I figured it out. I wasn't explicitly referencing any of the actual Crashlytics features so the Crashlytics files weren't being included in the actual build. This is likely related to the fact that link.xml
files are not honoured when they are included in packages: https://forum.unity.com/threads/the-current-state-of-link-xml-in-packages.995848/
Hi @jamier-hh,
I noticed that your minimal repro has the Crashlytics initialization and testing all in one script. Could you try following along the setup in the documentation and see if this works out for you?
It doesn't make a difference. Because the Crashlytics assembly is being included as a package, if you do not explicitly reference the assembly (by calling something like "Crashlytics.SetCustomKey"), Unity will strip it out. This is why there is a discrepancy between the minimal repo project and the quickstart project.
For most use cases, this wouldn't matter as most people will likely be explicitly referencing the Crashlytics assembly.
At this point, I'm not really sure this is an issue for the quickstart-unity package (I'm not sure it ever was to be honest haha)
Hi @jamier-hh, this sounds like a Unity optimization that removes unused code, do you agree? If so I'm not sure what can be done on our end to fix this problem other than advise users to always reference something in Crashlytics so that it doesn't get dropped.
What do you think?
Thanks!
Yeh, essentially. It isn't a problem if they are using the *.unitypackage version of Crashlytics as it will preserve the link.xml file. I would add it as a note for anyone who, like us, wants to use the *.tgz versions.
I'm marking this as a bug to create a ticket for us to update our documentation. Thanks for the issue!
HI @jamier-hh,
I wasn't able to succesfully reproduce this with the versions that you specified. I followed the published instructions for importing the Unity Package Manager, Firebase Core/App and Firebase Crashlytics SDKs.
I've done all of this in the Crashlytics Quickstart project from this repo. Before building for Android I commented out all Crashlytics code invocations from the source. I then built the app into an .apk
via Unity, and dragged and dropped the result into Android Studio where I was able to see the Crashlytics classes in the classes.dex
file. There existence in the APK suggests that the classes aren't being stripped out.
I then launched the test app and used it to create uncaught exceptions. Upon restarting the app - which kicks off the Crashltyics upload process - I see the results in the Firebase Crashlytics project console.
Could you follow these steps and post here what your results are? Thank you!
The original issue was iOS only, which was probably lost in my assertation of what the issue actually was - sorry about that. If you try the same steps for iOS, and open the project in Xcode. Specifically the Firebase.App.Crashlytics*.cpp
files will be missing from the Classes/Native
folder.
I've attached a version of the test app that reproduces the issue. You just need to add the dependencies to the package folder:
- com.google.external-dependency-manager-1.2.166.tgz
- com.google.firebase.analytics-8.1.0.tgz
- com.google.firebase.app-8.1.0.tgz
- com.google.firebase.crashlytics-8.1.0.tgz
Ok, thanks for the quickly follow up @jamier-hh. I was able to reproduce this behavior, and I'm sorry for the confusion about the Android target.
Interesting, looks like the prevention we put in Crashlytics no longer works.
Ex. this attribute, or the link.xml
(This file is not found on firebase-unity-sdk. But probably just an unrelated issue.)
<linker>
<assembly fullname="Firebase.Crashlytics" ignoreIfMissing="1">
<namespace fullname="Firebase.Crashlytics" preserve="all"/>
</assembly>
</linker>
It is pretty odd that this only affect .tgz
but not .unitypackage
.
Note that link.xml files are not supported inside packages, but you can reference package assemblies from non-package link.xml files.
You can put this link.xml
file into your main Assets folder and the .tgz
version will work.
This will be fixed with the upcoming 10.1.0 Firebase Unity SDK, so closing the issue.