Hello,
I recently upgraded firebase unity SDK in my unity project (had version 1.1.0 earlier... Yes I know, once I got it working, I just didn't want to touch it, so...). Nevermind, now the project is in production since nearly 2 years in both Android and iOS. But after this time while I was working on optimizing code of sending and receiving notifications, I felt like let's start with upgrading the firebase unity SDK version first. Now when I saw the latest version it was 5.4.3 (back in Dec 2018), and I said to myself, Shit! I quickly backed up the project and with shivering hands, I started upgrading the SDK.
I followed below steps to upgrade the firebase unity SDK to version 5.4.3:
1) Backup project
2) Delete all firebase related folders
3) Delete all firebase related .aar and .jar files from Assets > Plugins > Android folder
4) Delete all firebase related .a files from Assets > Plugins > iOS folder
5) Delete files google-services.xml and GoogleService-Info.plist
6) Download latest firebase unity SDK
7) Import from dotnet 3.x > Analytics, DynamicLinks, and Messaging one by one
8) Download latest google-services.xml and GoogleService-Info.plist from firebase console and import in project
9) Run Play services resolver > Version Handler > Update
10) Run Play services resolver > Android Resolver > Force Resolve (in an android project on windows)
11) Run Play services resolver > iOS Resolver > Install Cocapods (in iOS project on mac)
12) Build and run
Now since more than a month, I am entangled in build and runtime issues after following the above steps. I am not able to build my iOS project, and I am not able to run my android project. Adding to the nightmare, I have google sign-in plugin too, and it shares the Play game services with firebase, after the war with firebase related issues, the next one is waiting just over the hill.
Anyways, below is the error that I got while running the unity android project:
E/Unity: DllNotFoundException: FirebaseCppApp-5.4.3
at (wrapper managed-to-native) Firebase.DynamicLinks.FirebaseDynamicLinksPINVOKE/SWIGExceptionHelper:SWIGRegisterExceptionCallbacks_FirebaseDynamicLinks (Firebase.DynamicLinks.FirebaseDynamicLinksPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.DynamicLinks.FirebaseDynamicLinksPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.DynamicLinks.FirebaseDynamicLinksPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.DynamicLinks.FirebaseDynamicLinksPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.DynamicLinks.FirebaseDynamicLinksPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.DynamicLinks.FirebaseDynamicLinksPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.DynamicLinks.FirebaseDynamicLinksPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.DynamicLinks.FirebaseDynamicLinksPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.DynamicLinks.FirebaseDynamicLinksPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.DynamicLinks.FirebaseDy
2019-01-26 17:04:20.218 9585-9646/? E/Unity: DllNotFoundException: FirebaseCppApp-5.4.3
at (wrapper managed-to-native) Firebase.Messaging.FirebaseMessagingPINVOKE/SWIGExceptionHelper:SWIGRegisterExceptionCallbacks_FirebaseMessaging (Firebase.Messaging.FirebaseMessagingPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.Messaging.FirebaseMessagingPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.Messaging.FirebaseMessagingPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.Messaging.FirebaseMessagingPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.Messaging.FirebaseMessagingPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.Messaging.FirebaseMessagingPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.Messaging.FirebaseMessagingPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.Messaging.FirebaseMessagingPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.Messaging.FirebaseMessagingPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.Messaging.FirebaseMessagingPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.Mess
-------------------------------------------------------------------------------------
Now I even tried skipping steps 2, 3, 4 and 5 and tested it, but got same errors. For android I am using custom mainTemplate.gradle and custom AndroidManifest.xml in the Assets > Plugins > Android project. I had added it for firebase only following steps mentioned in an earlier version of the link here ->
https://firebase.google.com/docs/unity/setup
Now In a moment of epiphany, I just thought about deleting my custom AndroidManifest.xml and mainTemplate.gradle from Assets > Plugins > Android folder and to my joy it started working. Now initially the AndroidManifest.xml and the custom mainTemplate.gradle was set up for firebase only but now I guess these files are not required. Anyways, the Android build of the app is working fine now. I only got it working after deleting the files.
Now following the same steps in my unity project's iOS build, I am still stuck at a compile-time issue since nearly a month. Building the project for iOS throws following error at the end:
iOS framework addition failed due to a CocoaPods installation failure. This will will likely result in a non-functional Xcode project.
pod install output:
Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "GoogleAppMeasurement":
In Podfile:
Firebase/Analytics (= 5.15.0) was resolved to 5.15.0, which depends on
Firebase/Core (= 5.15.0) was resolved to 5.15.0, which depends on
FirebaseAnalytics (= 5.4.0) was resolved to 5.4.0, which depends on
GoogleAppMeasurement (= 5.4.0)
GoogleAppMeasurement (= 5.3.0)
CocoaPods could not find compatible versions for pod "GoogleUtilities/MethodSwizzler":
In Podfile:
GoogleAppMeasurement (= 5.3.0) was resolved to 5.3.0, which depends on
GoogleUtilities/MethodSwizzler (~> 5.2)
GoogleUtilities/MethodSwizzler (= 5.3.0)
pod repo update output:
Updating spec repo `master`
$ /usr/bin/git -C /Users/tdpl/.cocoapods/repos/master fetch origin --progress
$ /usr/bin/git -C /Users/tdpl/.cocoapods/repos/master rev-parse --abbrev-ref HEAD
master
$ /usr/bin/git -C /Users/tdpl/.cocoapods/repos/master reset --hard origin/master
HEAD is now at ac596d9f610 [Add] FitDataProtocol 0.31.0
CocoaPods 1.6.0.rc.1 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
-------------------------------------------------------------------------------------
I have tried updating the firebase unity SDK to 5.4.4, and again I am able to build and run the Android project but I am getting the same build time issues in the iOS project. My project settings have not changed, nor has the code (I mean before and after the firebase upgrade). Right now both the Android and iOS projects are using unity version 2018.2.14f1 and firebase unity SDK 5.4.4.
Questions:
1) Are my steps of upgrading the firebase unity SDK valid? If there is a better and safer way of doing it, please let me know.
2) Am I looking at any trouble if I delete the custom AndroidManifest.xml from Assets > Plugins > Android created as soon as I import the firebase unity SDK?
3) How to solve the build time issue mentioned above? I have tried changing the minimum target version to 11.0, but could not solve it.
Firebase community, please help! Thanks in advance.
Regards,
Sanket Kale.