quickstart-unity icon indicating copy to clipboard operation
quickstart-unity copied to clipboard

[Question] Can we use crashlytics without googleservice json and plist?

Open Thaina opened this issue 3 years ago • 8 comments

  • Unity editor version: 2020.2.6
  • Firebase Unity SDK version: 7.1.0
  • Source you installed the SDK:UPM
  • Problematic Firebase Component: Crashlytics
  • Other Firebase Components in use: Auth, FireStore, Analytics
  • Additional SDKs you are using: Facebook, AdMob, OneSignal
  • Platform you are using the Unity editor on: Windows
  • Platform you are targeting: iOS, Android
  • Scripting Runtime: IL2CPP

I try to build app that could switch firebase project when restart the app. So I don't want to include googleservice file into the build and want to create firebaseapp at runtime. However it seem Crashlytics trying to access those files in build process and cause build to fail. Is it anyway possible to do it?

Thaina avatar Mar 10 '21 06:03 Thaina

Hi @Thaina, It will help us debug if you could provide more information. I tried building the Unity Crashlytics quickstart example without google-services.json and it built just fine.

Here is what I tried,

  • Open the (Crashlytics unity quickstart) [https://github.com/firebase/quickstart-unity/tree/master/crashlytics/testapp] project in Unity 2020.1.7f1 and installed Firebase Crashlytics 7.1.0 unitypackage
  • Open "Assets/Firebase/Sample/Crashlytics/MainScene" in Unity and set "Build Settings" platform to Android.
  • Hit "Build" and the apk built without google-services.json
  • Check "Export Project" and the Android project was again exported without build errors.

Are you able to reproduce this problem in the quickstart and what is the error during the build?

vimanyu avatar Mar 11 '21 22:03 vimanyu

@vimanyu Sorry for some misinformation

  • android can be built without google-services.json but it was throwing error at runtime, maybe not related to crashlytics, I might try again some other times
  • ios was not able to build without GoogleService-Info.plist at all

Thaina avatar Mar 12 '21 01:03 Thaina

Hi @Thaina, I checked with the team. Since crashlytics is fully integrated into Firebase, so the google service json and plist file will be a requirement for projects to use it. The firebase setup is a precondition for crashlytics setup.

cynthiajoan avatar Mar 17 '21 17:03 cynthiajoan

@cynthiajoan Thank you. Then is it possible to change this? Can crashlytics be initialized and specified main project at runtime?

If it is I would like to have this issue as feature request

Thaina avatar Mar 18 '21 00:03 Thaina

Unfortunately it's not possible at the moment. The main reason is it requires a GoogleService-info.plist to upload symbols, and that happens during the build time.

cynthiajoan avatar Mar 18 '21 18:03 cynthiajoan

@cynthiajoan OK, then, howabout allowing us to specified multiple plist file asset for all project we can switch, but don't use it in the main runtime. Then upload multiple symbols for each plist ?

Thaina avatar Mar 19 '21 01:03 Thaina

Hey @Thaina, right now I don't know of a good way to do this. It may be technically possible by swapping out the Google Service files at runtime. If you were to try to figure out a workaround, it would probably require building the app in Unity initially with one file, and then trying to swap them out in Objective-C code. You are right that you would need to upload symbols for each plist file. Right now I know this is supported at build time on iOS, but I haven't seen it be done at runtime.

Regardless we'll leave this open as a Feature Request to judge interest if we ever decide to take this on!

samedson avatar Mar 23 '21 19:03 samedson

@samedson @Thaina we were discussing a similar issue in #880

This is a major issue for projects that build more than a single project out of a single codebase.

raybarrera-aofl avatar Jun 24 '21 21:06 raybarrera-aofl