I am using firebase phone authentication in my app. It works in the run-time apk. But when I generate a signed apk for realese purpose, the phone authentication doesn't work. It says the app validation failed (cf. the image below).
I think you missed to add SHA-1 of Release APK in your firebase project.
In order to get SHA-1 of Release APK,
keytool -list -v -keystore {keystore_name} -alias {alias_name}
For example,
keytool -list -v -keystore /Users/example/Desktop/example.jks -alias example
After you got fingerprint, just enter it in the firebase console like you did before using fingerprint for debug.
Related
I have old Xamarin android project. I made small changes and changed target to android x. The customer sent me a keystore file with password and alias. Now I need to sign and publish the package in google play. But I am getting the error your fingerprint does not match:
-need "Sha1Need"
-current "Sha1Other"
I check my key file with command:
keytool -list -v -keystore "my.keystore" -alias key -storepass mypass -keypass mypass
I get result value "Sha1Need".
Than I checking my apk with command:
keytool -printcert -jarfile my.apk
I get value "Sha1Other". How is it possible? And how can I fix this?
I use this code in my .csprj file:
<AndroidSigningKeyStore>app.keystore</AndroidSigningKeyStore>
<AndroidSigningStorePass>mypass</AndroidSigningStorePass>
<AndroidSigningKeyAlias>alias</AndroidSigningKeyAlias>
<AndroidSigningKeyPass>mypass</AndroidSigningKeyPass>
--UPDATED--
This was a problem on the customer's side. He changed the password on the key several times, and one of the options worked.
Error:
com.google.firebase.auth.FirebaseAuthException: This app is not authorized to use Firebase Authentication. Please verifythat the correct package name and SHA-1 are configured in the Firebase Console. [ App validation failed ]
You must re-generate SHA-1 by using your keystore, which is used to sign your APK. Then add generated SHA-1 to your firebase project configure.
For example: your keystore is: abc.keystore. Let run below statement to generate SHA-1
keytool -exportcert -alias <your_keystore_alias> -keystore <path_to_file>/abc.keystore -list -v -storepass android
Then copy the output SHA-1 in console and add to settings of your Firebase project
Try running below command in command prompt:
keytool -exportcert -alias <your_keystore_alias> -keystore <path_to_file>/key_name.keystore -list -v -storepass android
Once SHA-1 is generated, set it in Firebase console.
Note JAVA_HOME has to be set on Path variable in System Settings.
My application does not work when I upload it to the play store. It works fine when installing it from android studio.
Is there something special that's need to be done with the api key?
In windows this would be the command to get SHA1 key
Open a terminal window.
cd C:\Program Files\Java\jdk1.7.0_05\bin
Next we have to run the keytool.exe. Use the following line to get the Android SHA1 fingerprint.
(PRODUCTION KEYSTORE) keytool -exportcert -alias keystore -keystore "C:\Users\myusername\Documents\AndroidKeystore\androidkestore.jks" -list -v
(DEBUG KEYSTORE:)
keytool -list -v -keystore "%USERPROFILE%.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
Note the third point where keystore for production is retrieved. You need to add this value into your developer console as shown below
Go to your Google Api Console -->> Select your Project --> Go to Credential --> Click on Api key you generated.
Here you can check the packageName And your SHA 1 check if eveythign is proper.(you have submitted correct SHA1)
And It should work.
I made an Android app that uses Google Maps API to display a map.
When I run it with android studio it works fine. However after I publish it on the play store and download it from there all the maps show up as just grey screens.
I registered a key on google development console with both the debug SHA-1 key, which I got through this command:
keytool -list -v -keystore "%USERPROFILE%.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
And the release SHA-1 key which I got with this command:
keytool -list -v -keystore [my\keystore\path] -alias [releaseAlias] -storepass [storepass] -keypass [keypass]
I've also unzipped my release APK and checked it with this command:
keytool -printcert -file CERT.RSA
And it shows the same SHA-1 key as the release key above.
Am I still getting the SHA-1 key for release incorrectly? Is there another way to get and verify it?
EDIT: I found the problem. It was like the top reply in Android SHA1 release keystore not working with Google Maps said. There were two google_maps_api.xml files, one in debug and one in release and android studio only showed the debug one. Manually editing the release xml to add the key fixe it.
I got the SHA-1 fingerprint from using the keytool for my application on my key that I sign the application with when I upload it to the play store.
But when I open the app on my phone for testing it says it is not the right key. ANy ideas what I could be doing wrong?
Not sure what more information i can give without giving security info for my app, so if you can help give me anymore information that I can not think of please let me help you help me.
First for the development generate a SHA-1 from debug.keystore:
Navigate to C:\Program Files\Java\jdk1.6.0\bin>..... where your bin located then execute below command
C:\Program Files\Java\jdk1.6.0\bin>keytool -v -list -alias androiddebugkey -keystore "D
:debug.keystore" -storepass android -keypass android
or
C:\Program Files\Java\jdk1.6.0\bin>keytool -v -list -alias androiddebugkey -keystore "C:\Documents and Settings\user1\.android\debug.keystore" -storepass android -keypass android
Now, you can get one SHA-1 certificate and generate API key from Google API console. Add this key into your manifest.xml file. remember this API key only for the development. Using this key built apk u can not publish into market.
Now, turn to make your own keystore: execute below command
C:\Program Files\Java\jdk1.6.0\bin>keytool -genkey -v -keystore OWN.keystor
e -alias ALIASNAME -keyalg RSA -keysize 2048 -validity 300000
and give all the required details for this keystore. Now time to generate SHA-1 from your OWN.keystore execute below commnad
C:\Program Files\Java\jdk1.6.0\bin>keytool -v -list -alias ALIASNAME -keystore "C:\Program Files\Java\jdk1.6.0\bin\OWN.keystore" -storepass PASSWORD -keypass KEYPASSWORD
Now, you can get one SHA-1 certificate and generate API key from Google API console. Replace this key into your manifest.xml file. Now your app is ready to publish into market.
This may helpful to you.
Have you tried to completely remove the application and then install it all over again. This key might be got cached and even if you install the application with new key.
So before you install your application with the new key, try to remove the application completely from the phone.
You can as well go over this blog post I wrote and make sure you do all the steps right in producing the key:
Google Maps API V2 Key