Something went wrong with Google Auth only on Android - android

My firebase authentication used to work smoothly on my IONIC app on both iOS and Android.
Testing on Android after quite a few changes working on IOS side, I can no longer make a google login, though it still works well on iOS it gives me this on Android.
I already checked my SHA1 and SHA256 configuration in firebase console.
Loging in with google also works on a web browser. It only fails on Android.
Any suggestion is welcome.

I had the same problem in the Ionic Capacitor for android version...
Check if your SKD was automatically updated...
I don't know why it changed my SHA-1 run the command to get the SHA-1 and compare with the atual in your firebase (mine was different)
-> keytool -exportcert -list -v -alias androiddebugkey -keystore %USERPROFILE%.android\debug.keystore
go inside your firebase console (console.firebase.google.com) include the new SHA-1 and download your new google-service.json, change the file in your project and try again - for me works fine
The IOS application works fine due to the firebase didnt need the sha-1, but only the package ID
I Checked again and found that I created a new key for my project, this changed the SHA-1, so I included the SHA-1 in firebase, both for debug and release, after this, google login returned to work
keytool -list -v -keystore C:\Users\biel7\.android\Release.jks -alias Release
using the command above, returns my release SHA-1, because in my case when i tried to create the release APK the google login stopped works

Related

Google Sheet API is Not Working in Release Build

Am using Google Sheet API in my Android App. It's working fine as expected in debug mode. Stopped working when I published it in the play store. Now App is getting crashed due to it. Users seem unhappy now!
Make sure that you update the SHA-1 with the release SHA-1 in the Key restriction section at the Google developer console.
Steps:
Open the Google Console.
Select your project.
Select credentials.
Select your key.
You see the picture below explaining where to edit the SHA-1.
You can get the "Release certificate fingerprint" from the following command.
keytool -list -v -keystore your_keystore_name -alias your_alias_name

How do i generate a signed APK that uses Firebase Auth?

I've built the App on android studio. When I connect my phone to my PC and build it directly through Android Studio it works. I get the phone verification code and am able to sign in. But when I generate a signed APK to distribute it to others, it always says "Verification Failed" and doesn't let me sign in.
I'm pretty sure there's no problem with the code, because it works perfectly when I build it through Android Studio directly onto my phone.
What Ive Tried:-
I followed the steps in this link and changed the SHA-1 code in my firebase console to the one provided in my Google Console, it still says verification failed.
I also tried to keep only one SHA-1 key in my firebase console which is the one i found in my android project, updated the google-services.json file and tried generating a signed APK, its still says verification failed.
Generate a new SHA1 fingerprint from the console in Android Studio using
keytool -list -v -keystore <absolute path of Keys generated during signed APK generation> -alias <app alias name>
Paste the generated fingerprint in the firebase console and delete the older one.
Hope this works!

Signed .apk not working where debug .apk works fine

I am facing a problem of my android app(online streaming app). I had to make an app in which performs online video streaming. It has firebase phone number authentication. my problem is that the debug app is working properly but the signed apk is not working properly at authentication section. it does not send verification code. please help me out configure it..
Often, this kind of problem is linked with the android permissions. The app works fine in debug mode because android is "allowing" your phone by default.
Try to add the "android.permission.INTERNET" in your android manifest and try to deploy the app again.
Hope this is helpful, good luck
You need to add SHA1 of your release key store file in firebase console.
you can get SHA1 with follow command
keytool -list -v -keystore {keystore_name} -alias {alias_name}
eg:
keytool -list -v -keystore C:\Users\me\Desktop\release.jks -alias sample

Android map not working in built apk version

I have developed an android application which has a map fragment in it. I got the "map key" from "google developer console" by specifying my project's package name and other required details.
I generally test my application by connecting an actual device to my machine and everything works ok. But when i build an apk as a debug or release version and install the apk in the same/different device, it doesn't show the map at-all.
I use Android Studio for development and build process.
How do i fix this issue? I am definitely sure that its something to do with the key not being picked properly when i build the apk but i am not sure how to fix this issue!
Update 1:
I figured out the problem using all of your suggestion. The part which i missing was that i was generating a new keystore in Android studio using "Generate signed apk" so that my apk is signed with the new SHA-1 for the release but i was not telling google that it needs to consider my new SHA-1.
So i did the following
I went on the terminal/command prompt, got the newly created SHA-1. I used the command "keytool -list -keystore my_key_store_name.jks -alias my_key_store_alias_name" . This displayed my SHA-1
I copied the SHA-1 and went to google developer console and added the project's package name and the new SHA-1
After the above steps, my map is displayed properly. :)
Thanks everyone for helping me solve it.
When you run app without creating apk then it will take your debug keystore as a keystore and you have set that key on developer console.
When you create apk then that apk will get created using different keystore i.e your app keystore.
keytool -list -v -keystore ~/.android/debug.keystore -alias
androiddebugkey -storepass android -keypass android
keytool -list -v -keystore kestore_location -alias kestore_alias_name
-storepass android -keypass kestore_pasword
So has-key created using that keystore is not set on developer console.
You just need to create new hash-key using app kestore and add it on developer keystore.
It will display map.
While building your application and installing it directly from studio, studio will use the debug key.But while releasing the app, the apk has to be signed with release key instead of debug key.The Android SDK tools generate this release certificate when you do a release build.
So for generating the map key, if you are in development phase, you can use debug key to generate map key. But when you release the app, you have to obtain new map key using the release key and replace that in your manifest file.
Regarding signing your app, refer this link and this so
I think there is problem with SHA. Please check once again for SHA.
Follow these steps to find correct SHA and match with console SHA
In Android Studio:
1. on right side of window just click on Gradle
2. refresh
3. app---> task---->android--->signingReport
4. SHA will display on Console
the generated SHA add on google console.
Happy Mapping

Google maps has stopped working on android after I switched from windows to linux

I am developing an app which requires google maps on android. Earlier I was developing on Windows and everything was working perfectly. A few days ago I switched to ubuntu and the maps suddenly stopped working. I have added the sha1 key to the console -
API key:
AIzaSyDD3ntjHTCKntDoVJt7J_eMZs-t7lYIlZ8
Android apps:
98:26:30:05:AF:D7:74:3F:5F:C1:BF:D6:24:80:5E:9B:DC:F4:F4:D6;com.opaxlabs.boatbrat EB:53:F8:2A:B3:05:63:5E:3F:CF:17:47:63:A8:8B:FA:C8:67:30:D4;com.opaxlabs.boatbrat
Activated on: Jun 25, 2014 5:07 AM
So that I have two sha1 fingerprints. I switched back to windows to check and the app was working perfectly there. The error in log cat states that -
Google Maps Android API(10773): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
The build when run on devices shows a blank screen where there should be a map.
The api key is mentioned in the manifest as -
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDD3ntjHTCKntDoVJt7J_eMZs-t7lYIlZ8" />
Also in the emulator it asks me to update the api showing me a button to update which when clicked crashes the app. Please help me with your suggestions. Thanks in advance.
Edit:
The problem seems to be in the fact(Although I am not sure about it) that I had created a demo project on the google console and put the sha1 in it. Later I created a project and put a sha1 in that too. It seems that it was taking the key from the demo project and not the proper project. I have deleted the contents of the demo project but to no avail. Is there a way to correct this problem?
Open terminal
navigate to /usr/lib/jvm/java-1.7.0-openjdk-amd64/bin (bin of java )
write On terminal :- keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android
4.copy the SHA1 key and paste in place of the previous SHA1 of your windows
dont change anything else.
its working......
Seems like an issue with the api key.
Generate sha1 of the debug certificate on your ubuntu, and add it to the api console as another key in addition to the sha1 of certificate from windows.
That should solve the problem.
Regenerate sha on your pc,
Go to google console,
Create new Android key (for google map),(delete the old)
For Linux:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
Copy sha with name of your project , for example: (Sha;projectname)
98:26:30:05:AF:D7:74:3F:5F:C1:BF:D6:24:80:5E:9B:DC:F4:F4:D6;com.example.androidapp
Copy API key to app.
In google console your Android apps have 2 times sha and project name.

Categories

Resources