Troubleshooting Codemagic Deployments with Changing SHA1 Key for Firebase App Distribution

142 Views Asked by At

Can anyone help me solve a puzzle regarding deployments in Tech? I'm trying to perform deployments with Codemagic on Android using Firebase App Distribution, but I'm encountering an issue with the SHA1 key. The SHA1 key of my cloud instance changes with each build, and Codemagic doesn't seem to take this into account. As a result, Google Auth within my Flutter app isn't working properly. Any ideas on how to address this?

I attempted to deploy my Flutter app using Codemagic to Firebase App Distribution. During the deployment process, I noticed that the SHA1 key of my cloud instance was changing with each build. To address this, I initially tried to manually add the SHA1 key to my Firebase project, but this approach was not sustainable due to the changing keys.

My expectation was that Codemagic would handle the SHA1 key configuration seamlessly, given that it's a critical component for Firebase services like Google Auth. I expected the deployment process to recognize and adapt to the changing SHA1 keys to ensure that Google Auth would work correctly within my Flutter app.

However, despite my efforts to manually configure the SHA1 key, the issue persisted, and Google Auth continued to malfunction. I am now seeking guidance and potential solutions from the community on how to resolve this problem and achieve consistent and successful deployments with Codemagic and Firebase App Distribution.

2

There are 2 best solutions below

0
Mikhail Tokarev On
  1. if you use Workflow Editor make sure you uploaded your production keystore and don't generate a new keystore with every build

  2. the same applies for codemagic.yaml file too. Make sure you don't have keytool -genkey in your scripts

0
Thiago Dias On

I had the same problem, I solved it like this:

In Codemagic go to App -> Workflow edit -> Distribution.

enter image description here

Activate the "Enable Android code signing" option. Add a suitable KeyStore, which contains your SHA1 key. Add the other data: Keystore password, key alias...

In this link there is a tutorial on how to generate a keystore.

If you do not carry out this process, codemagic will generate a random SHA1 when compiling your project, and the Google Play Store will not allow you to upload your apk, since it uses a different SHA1 than the one in the Google Play Store .

If you want to check the SHA1 contained within your .keystore file, you can use the following command:

keytool -v -list -keystore ketStoreNameExample.keystore