Closed joaoborks closed 2 months ago
I took a look at this and notice you're only seeing the tool failure for iOS, but your issue is on Android. The Firebase Unity plugin has a different process for generating the build id
/ mapping file id
for Android. It looks like that part didn't fail. It is possible the build id
is being removed by a resource shrinker or something.
You can add a keep rule like this: https://github.com/firebase/firebase-android-sdk/blob/master/firebase-crashlytics/src/main/res/raw/firebase_crashlytics_keep.xml to your Android build. Or simply wait for the next version of Crashlytics which will include this keep rule automatically to deal with an upcoming change in the default behaviour of R8.
I took a look at this and notice you're only seeing the tool failure for iOS, but your issue is on Android.
That's not an accurate description of the issue. Since the Unity iOS Module is not installed, the Firebase.Crashlytics.Editor.dll
does not load, even if we're only building for Android. The outcome is that the Android build does not have a build id
information because the Firebase.Crashlytics.Editor.dll
is not loaded and therefore will not execute the Crashlytics build post-process script that generates the build id
.
The proposed workaround perfectly solves the issue.
That's not an accurate description of the issue.
Ok got it.
The proposed workaround perfectly solves the issue.
Since the workaround works, then the next release of the Unity plugin that includes the latest Crashlytics will resolve this issue, and you'll be able to remove the workaround. I'll close this for now since the workaround is working. Feel free to file a new issue if you run into the issue on the future version, and it might be better to file it in https://github.com/firebase/firebase-android-sdk if it is Android specific.
[REQUIRED] Please fill in the following fields:
[REQUIRED] Please describe the issue here:
I have a correctly set project that works for both platforms if built locally, but does not work when built by CI, and that is because the CI runner is a Linux machine with only the Android module installed. As described by unity-jar-resolver#412, the packages require the Unity iOS module to be installed, otherwise might cause issues when building. That is the exact case that happens on my CI setup.
Since my CI runner does not have the iOS Module, the
Firebase.Crashlytics.Editor.dll
can't be loaded and therefore cannot generate a crashlytics build id at build time, resulting in a crash with the following error on build:The Crashlytics build ID is missing. This occurs when Crashlytics tooling is absent from your app's build configuration. Please review Crashlytics onboarding instructions and ensure you have a valid Crashlytics account.
Steps to reproduce:
Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?
What's the issue repro rate?
What happened? How can we make the problem occur?
Locally
Ensure you have the
Firebase Crashlytics
package installed, you do not have the Unity iOS Module installed, and clear your project's Library folder. Then, build the unity project from the command line.On CI
Make sure you have the
Firebase Crashlytics
package installed. Run a build job for Android with alinux-android
runner.The outcome
Observing the build log, regardless of the way you built the app, you'll see the error:
This will prevent the crashlytics build id from being generated at build time. And will ultimately crash the Android build at startup.
Our Workaround
We import the Firebase packages through .tgz and embed them into our repository for local UPM reference. So, to effectively workaround the issue:
.tgz
package file to a folder. In my case, they were:Packages/com.google.external-dependency-manager/ExternalDependencyManager/Editor/<version>/Google.IOSResolver.dll
Packages/com.google.firebase.crashlytics/Firebase/Editor/Firebase.Crashlytics.Editor.dll
Packages/com.google.firebase.app/Firebase/Editor/Firebase.Editor.dl
.dll.meta
and.pdb.meta
files (for exampleFirebase.Editor.dll.meta
) and add the line:package.json
file lives) and runnpm pack
on the terminal (make sure to install node if you don't have it).tgz
package you can replace in your projectYou can tell when a build will work when you find this line in the build logs (I usually just ctrl + F "generated resource"):
Final Considerations
Our workaround is not the ideal way to fix the issue permanently. I believe that any platform-specific code should only be compiled if the platform is available, be that by constraining the assembly to a single platform, or by using
UNITY_IOS
orUNITY_ANDROID
preprocessor directives.The original issue on the unity-jar-resolver repository is 2 years old, and that is somewhat revolting. I understand that there are more urgent fixes and features on the line, but can it have some attention, please? It's ironic that an SDK to detect crashes ultimately causes your game to crash at startup because it was unable to find an id that itself was responsible for generating.