We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Based on googlesamples/unity-jar-resolver#365
The user request to be able to generate google-services.xml properly if they try to change application Id right before building. Ex.
google-services.xml
using UnityEditor; public class Build { [MenuItem("Tools/Build/Debug")] public static void BuildDebug() { PlayerSettings.productName = "debug"; PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, "com.firebaseExample.debug"); BuildPipeline.BuildPlayer(new[] { "Assets/Scenes/SampleScene.unity" }, "debug.apk", EditorUserBuildSettings.activeBuildTarget, BuildOptions.None); } [MenuItem("Tools/Build/Release")] public static void BuildRelease() { PlayerSettings.productName = "release"; PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, "com.firebaseExample2.release"); BuildPipeline.BuildPlayer(new[] { "Assets/Scenes/SampleScene.unity" }, "release.apk", EditorUserBuildSettings.activeBuildTarget, BuildOptions.None); } }
Currently GenerateXmlFromGoogleServicesJson.cs (in Firebase.Editor.dll) relies on PlayServicesResolver.BundleIdChanged event to change google-services.xml when application id change. However, the event only triggered in the next update from the main thread. https://github.com/googlesamples/unity-jar-resolver/blob/825901fa297065d651709fdc34cc5433410c8869/source/AndroidResolver/src/PlayServicesResolver.cs#L1370
GenerateXmlFromGoogleServicesJson.cs
PlayServicesResolver.BundleIdChanged
@master-lincoln came up with a workaround to utilize reflection to force trigger this event
Type type = Type.GetType("Firebase.Editor.GenerateXmlFromGoogleServicesJson, Firebase.Editor"); var method = type.GetMethod("OnBundleIdChanged", BindingFlags.Public | BindingFlags.NonPublic| BindingFlags.Static); method.Invoke(null, new[] { (object)null, new PlayServicesResolver.BundleIdChangedEventArgs { BundleId = newAppId, PreviousBundleId = oldAppId } });
However, there should be a better way to support such case.
The text was updated successfully, but these errors were encountered:
I was changing Application Id from the build script and game-services.xml was not updated properly.
game-services.xml
I think I fixed it and my current build script looks like this:
google-services.json
GoogleService-Info.plist
AssetDatabase.Refresh();
GenerateXmlFromGoogleServicesJson.ForceJsonUpdate(false)
Sorry, something went wrong.
No branches or pull requests
Based on googlesamples/unity-jar-resolver#365
The user request to be able to generate
google-services.xml
properly if they try to change application Id right before building.Ex.
Currently
GenerateXmlFromGoogleServicesJson.cs
(in Firebase.Editor.dll) relies onPlayServicesResolver.BundleIdChanged
event to changegoogle-services.xml
when application id change. However, the event only triggered in the next update from the main thread.https://github.com/googlesamples/unity-jar-resolver/blob/825901fa297065d651709fdc34cc5433410c8869/source/AndroidResolver/src/PlayServicesResolver.cs#L1370
@master-lincoln came up with a workaround to utilize reflection to force trigger this event
However, there should be a better way to support such case.
The text was updated successfully, but these errors were encountered: