JinWon Lim
JinWon Lim

Reputation: 31

Unity/Firebase - Project Bundle ID does not match any bundle IDs in your google-services.json files

I'm making a mobile game on Unity, Android first.

And now I'm integrating firebase analytics.

After set info on Firebase Console and put google-services.json file into Unity project, Unity shows an error saying :

Project Bundle ID com.RetroSpirit.ToiletRush does not match any bundle IDs in your google-services.json files
This will result in an app that will fail to initialize.

Available Bundle IDs:


You need to either:
* Fix your app's bundle ID under "Player Settings --> Bundle Identifier"
or:
* Add another app to your firebase project
  Goto https://firebase.google.com/docs/unity/setup#add_firebase_to_your_app_1
  and add the new configuration file to your project.

UnityEngine.Debug:LogError(Object)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:LogErrorIfEnabled(String)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:FindGoogleServicesFile(SortedDictionary`2, String, LogMessage, LogMessage)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:FindGoogleServicesFile(String, LogMessage, LogMessage)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:UpdateJson(Boolean, LogMessage, LogMessage)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:OnPostprocessAllAssets(String[], String[], String[], String[])
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets(String[], String[], String[], String[], String[])
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Here's the part of google-services.json,

 "client": [
    {
      "client_info": {
        "mobilesdk_app_id": "*:***********:android:****************",
        "android_client_info": {
          "package_name": "com.RetroSpirit.ToiletRush"
        }
      },
      "oauth_client": [
        {
          "client_id": "***********-********************************.apps.googleusercontent.com",
          "client_type": 1,
          "android_info": {
            "package_name": "com.RetroSpirit.ToiletRush",
            "certificate_hash": "****************************************"
          }

I don't know what should I check.

Project Bundle ID (the Package name on Build Settings - Other Settings - Identification) is exactly same as package_names in google-services.json.

Any ideas?

Upvotes: 2

Views: 13413

Answers (6)

Abdulrhman Ahmed
Abdulrhman Ahmed

Reputation: 1

hey everyone I found a fix to this issue I'm using mac pro m1

step to fix

  • reinstall visual studio
  • download Microsoft.NET.Sdk.Android from the visual studio website
  • restart the project

and after that, it will fix

Upvotes: 0

Manuja Dila
Manuja Dila

Reputation: 23

In my case, the issue was with the Package Name. So I followed the following steps and solved the problem:

  1. Change the package name (com.companyname.appname) [everything in lowercase]
  2. Delete the existing keystore
  3. Add a new keystore and generating a fingerprint with Keytool
  4. Delete the current app from the Firebase console
  5. Add a new app with the correct package name and the generated fingerprint
  6. download google-services.json again and Import to Unity under the Assets folder

Done! It works!!

Upvotes: 0

Guilherme Muniz
Guilherme Muniz

Reputation: 1275

My case was in Unity and to fix it I added the google-services.json from the firebase project to the assets folder. I had only the GoogleService-Info.plist before.

Upvotes: 1

Onat Korucu
Onat Korucu

Reputation: 1042

In our case we solved the issue by requesting a new google-services.json file from a collegue who has admin rights.

Upvotes: 0

chrisarton
chrisarton

Reputation: 4441

I understand you have fixed this by re-installing Windows but this is how I got passed this problem in case anyone else runs into this:

Make sure you have set your Package Name in Unity player settings (Edit > Project Settings > Player > Other Settings > Identification > Package Name).

Set to the same one you set up in Firebase (looks like com.CompanyName.ProductName).

Make sure you have imported the Firebase assets into your Unity project as described here https://firebase.google.com/docs/unity/setup and that the Firebase folder exists in Assets > Firebase. Changing the location of this folder seems to break things.

Upvotes: 1

JinWon Lim
JinWon Lim

Reputation: 31

Little bit funny to answer myself...

I found the reason of problem accidently. There was something wrong with my VC runtime so generate_xml_from_google_services_json.exe couldn't extract package name from google-services.json. (vc90.crt.manifest could not be extracted!)

Unfortunately, I couldn't fix that runtime error despite so many re-install of Visual Studio, VC Runtime and .net frameworks. Finally I re-installed Windows 10 and the problem just gone away... Still don't know what caused this error.

Upvotes: 0

Related Questions