getToken() failed. Status BAD_AUTHENTICATION error - android

I've found the following error when running my android application in android studio. app couldn't get installed on my device because of this error. Didn't find the solution :(
please help
Auth: [GoogleAccountDataServiceImpl] getToken() failed.
Status BAD_AUTHENTICATION,
Account: ,
App:com.android.vending,
Service: androidmarket com.google.android.gms.auth.be.account.b.d: Long live credential not
available.

I had the same issue what helped me was that I had wrong credentials in my google-services.json file and after getting a new file my problem was fixed.
in the process of resolving this issue I also updated my google play services but I do not think this is necessary .

I got this error when tried to install app directly from Android Studio.
It was due to certificate mismatch, since I used release certificate for setting up the app in Play Console, while Android Studio signs the app with debug certificate by default.
Installing app via adb resolved the error.
https://developers.google.com/games/services/android/quickstart#step_4_test_your_game
Make sure to run an APK that you exported and signed with a
certificate that matches one of the certificates you used during the
application setup in Google Play Console.

I have the same problem some days ago. I just compile my whole code in a new project and Problem Solved!!.
Don't know what was the real problem. There is an issue filed here, with no solution.

There are several reasons you can get that message:
The account you are trying to log on with needs to be re-authenticated on the phone (try a different account)
The gms:play-services version is out of date (needs to be 15+ as of Jan 2021)
Your app fingerprint is not the right one. You need one for dev builds, different one for prod -- which is different based on how you sign (do you have the final publish key, or does Play store re-sign with the final publish key?)
Follow the Google tutorial and get their stand-alone project, it should take 20 min, and check your setup there. If you are running it with all the right accounts it should work. Then go back to your app.
https://developers.google.com/identity/sign-in/android/start

I updated Google Play Services on my phone and stopped receiving the same error. I am importing com.google.android.gms:play-services-cast:9.6.1 and analytics:9.6.1. Not sure if the version running on the device was too low but problem is now resolved but not sure how to prevent this error for users running older versions of Google Play Services.

Tested the other solutions but nothing worked. Rebooted the device and error was gone.

If you using firebase server, As per the firebase updation if you give phone number authentication put your country code before contact number it is mendetory.
example - +91 9999998888

This happened to me, auth errors in ADB, among them:
android Warn Auth [GoogleAuthUtil] GoogleAuthUtil
Because, like mentioned above, I had a debug build running on phone previously. So I fully uninstalled the app on my phone, and the next [Build and Run] ran successfully.

Please try the App with new google credentials or even try creating the whole peoject on console og google play services if you have used it .

In my case it was a dependency version problem. I had to update the auth dependency for firebase to the latest one:
implementation 'com.google.firebase:firebase-auth:17.0.0'

Here is my take towards this problem:
You may be using a single email to try and log in to google. It may be possible you might have changed the password of the particular email in the recent past. Make sure u remove your google-email from your phone/emulator. When u re-run your application, you will be asked to enter both email and password credentials.
Check if your credentials.json is still valid. Sometimes its possible that your client ID might be removed/corrupted if you have not used your android application for a long time. Make a new one and dont forget to copy-paste it in app folder of Android Project view.
PS: I am new to Android Studio and writing answers on stackoverflow in general. If you are reading this comment please let me know what improvements i can make while answering questions in the future.

I copied and ran the code in a different project that had priorly worked on simple DB operations of Firebase. Probably it already had the authentication files in place so launching the app was solved there

Mostly your token has gone bad. And needs a new one.
Go to project database > settings > General > download Json file and replace it with the one in the local project directory.

I fixed this problem with updating fingerprints (sha1 or sha256)

My problem was with Microsoft App Center.
We recently set our pipelines to send aab files to App Center, instead of apk files.
It seems that our bundle was resigned by App Center with some generated keystore. That's how App Center distributed apk files, even though our pipeline uploaded aab files.
In other words: even though our pipeline is using our own keystore to sign the aab bundle, in order to distribute through the App Center, after sending the aab to App Center, the App Center is creating universal apks with another generated keystore.
After rolling back our pipeline to send apk instead of aab, Google SignIn on our react-native app with firebase was working again.
"When you distribute Android Application Bundle (AAB), App Center generates a universal APK, signs it with a generated signing key, and distributes it to a device."
Source: https://learn.microsoft.com/en-us/appcenter/distribution/uploading

Related

Failed archiving Xamarin.Forms Android app, no keystone file

I am not really a mobile developer but this project was on the board and I was interested so I took it. I made several changes to this Xamarin.forms app and published the changes to the Apple App Store successfully but I am having an issue deploying to Google Play. I may very well not understand this process so bare with me.
I have access to a developer account, our store page, and an admin user account. On the apps console page on the production tab I am editing the current release. "Releases are signed by Google Play".
In Visual Studio for Mac 2022 v17.3 the project.mobile.droid package builds successfully every time with no errors (release is selected here). The android packaging format is set to tab, which is what I want. But when I try to archive for publishing I get the error:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Error XA4310: `$(AndroidSigningKeyStore)` file `C:/Users/tortis1/AppData/Local/Xamarin/Mono for Android/Keystore/prodensity/prodensity.keystore` could not be found. (XA4310) (Density.Mobile.Droid)
First thing I notice is Users/tortis1/AppData. Maybe I'm unaware of something but there is no tortis1 in my Users folder so I have no idea how to track this down. I have looked for a keystore file in the project and I could find these in the Debug folder: android_debug_keystore.flag, android_debug_keystore.flag, and debug.keystore.
I have not set up any kind of singning rules or credentials in VS for Mac. Have I skipped some step or am I missing something? If you need any further information please let me know.
I have tried working through similar questions like this: How do I generate Google Play Console upload key using Xamarin Forms? , but I can't get it to archive at all.

GoogleSignInClient connects only when app's installed from Google Store

I am developing an Android game and currently trying to integrate with Google Play Game Services. I got stuck at the sign-on feature.
I use GoogleSignIn, getIntent, startActivityForResult etc. - all as described in Google manual. I think all's setup correctly, because when I build the app, deploy to Google Store (Internal Tests), and then I install it from there, all looks good: onActivityResult is called with result.isSuccess()==true and GoogleSignIn.getLastSignedInAccount returns != null.
The problem is when I try to run the app from Android Studio (or install APK manually). In this case, onActivityResult is called with SIGN_IN_REQUIRED and getLastSignedInAccount is always null. I am pretty sure all's setup fine (APK is signed, Android Studio is configured to sign the APKs etc.).
To ensure it's not about my Android Studio setup, I have installed manually exactly the same APK which I uploaded to Google Store but again - result is the same. When installed from Google Store, it's OK, when installed manually it's not (again: exactly the same APK binary).
Can you please help me? Theoretically I could continue development, but each I'd like to test something I'd need to upload new version to Google Store...
Thank you
Hmmm...its usual DEVELOPER ERROR, what you can do it..add your SHA1 code on firebase console, and it will work, it is showing this behaviour caus your signed key SHA1 is already added, that why it is working on release build and not on debug build, add your systems SHA1
How to get SHA1?
usually right side of android studio have a bar which says gradle click on it, expand it got to app>Tasks>android>signing report double click it...it will give you your SHA1, paste it on firebase console, wait for 1-2 minutes and check. It will work.

How to fix App not installed error in Android

I develop android application and when create APk from this application (with Generate Signed APK) and when install this apk in other devices not install and show me this error on phone : App not installed
how can i fix it?
This is usually caused when you have a debug apk that is signed with a different certificate and you are trying to install a release version with a different certificate. If you have a debug apk on the device try uninstalling it and try again.
For me, **disabling Google Play Protect** options from play store app worked , and i was able to get rid of the App not Installed error.
Check the play protect option available in Google Play Store Navigation menu.
android:extractNativeLibs="true"
in AndroidManifest.xml file fixed the problem for me.
<application
// ...
android:extractNativeLibs="true"
Notes: I got this error when building with App Center and all the signing was handled by app center.
For easier debugging just drag and drop the apk file in the android emulator.
Your will get a more detailed message why the app is not installed.
Previously I tried all the Play protect things and checked the build.gradle file contains no release info in signingConfigs and that there's no signingConfig in buildTypes.release just as described in the other answers from this page.
delete build folder from your project and then build project again.. working for me
File an appeal with Google Play Protect
Proper way to create URL to download your APK file
You need to make a direct link to download application, not to a drive.
First, I uploaded my application on google drive and shared the link.
after submitting the apeal I instantly received a mail
Hi
You recently submitted an appeal for an app with Google Play Protect.
The link you have provided does not lead to an APK file or the file is
corrupted. Please submit a new appeal and check that you are providing
the link to the correct APK file.
Thank You, Google Play Protect Team
Upload your APK file to dropbox (didn't try any other platform)
Get sharable link (link setting should be Anyone with this link can view the file.)
Your link will something like this https://www.dropbox.com/s/xxxxxxxxxx/ApplicationName.apk?dl=0
Change the ending apk?dl=0 to apk?dl=1 (Changing it to 0 will make the link to direct download the APK, try it yourself and see.)
Your new link should be like this https://www.dropbox.com/s/xxxxxxxxxx/ApplicationName.apk?dl=1
Use any URL Shortner
Your acceptable link is ready
If you don't know what is your Application package name, then go to your AndroidManifest.xml
There will be line package="com.example.MyApplication"
After submitting it if everything goes correct you may receive a mail instantly from Google
Hi
You recently submitted an appeal for an app with Google Play Protect.
We have successfully received the appeal for your app. Our team will
review the app and any information you have provided.
Thank You, Google Play Protect Team
Don't expect any other reply from Google Play Protect Team, In my case, I didn't receive any mail, But the issue was solved, After a 2-3 business day the issue was fixed while installing the application I no longer received the Blocked by Play Protect warning. and App not installed
I know this is an old thread, but I have had the same "App not installed" issue that I have been struggling with, this is how I solved it.
Connect your device to your computer, and just before you start installing the app, run this command from commandline:
adb logcat > logcat.txt
And stop it right after you get the "App not installed" message. (Ctrl + c).
The reason for starting and stopping it just around the install process is because logcat is very "chatty".
Have a look in the generated text-file to find the error. It can be like finding the needle in a haystack, but I found my error just before "packageinstaller.InstallFailed" log-line.
The error looked like this:
10-10 21:36:43.402 1549 1940 E NativeLibraryHelper: Library 'libjsc.so' is not page-aligned - will not be able to open it directly from apk.
10-10 21:36:43.402 1549 1940 W NativeHelper: Failure copying native libraries [errorCode=-2]
10-10 21:36:43.403 1549 1940 E PackageInstallerSession: Commit of session 1728055717 failed: Failed to extract native libraries, res=-2
I fix this issue by correct the targetSdkVersion from build.gradle file.
My solution for this issue, I monitored the Logcat and could see the error because my app was not installed.
I received message DOWNGRADE VERSION, added a VersionCode in BuildGradle and for me it's working.

Xamarin Debug Keystore Seems to have Changed

I am developing an Android Application using Xamarin.Android in Xamarin Studio. It uses Google Play Game Services.
The project has run and tested find up until this point. Yesterday I upgraded my development PC from Windows 7 to Windows 8.1. In the process I also had to reinstall Xamarin Studio.
Now when my app attempts to connect to Google Play, it fails with error "RESULT_APP_MISCONFIGURED" which as far as I can tell means that my app is not properly authorized to access the Google Play API. However, nothing has actually changed.
I tested an older version of the app, and it is still able to connect to the Google Play API. Nothing in the code itself has changed, so I think it must be something to do with my recently upgrade of Windows, or the recent re-install of Xamarin Studio.
Any thoughts on what would help narrow down the problem? Is it possible the debug keystore has changed somehow?
An additional clue: when I attempt to build an deploy to a device that has the older, working version of the app on it, I get the following error:
Deployment failed because of an internal error: Failure
[INSTALL_FAILED_UPDATE_INCOMPATIBLE]
I then have to manually uninstall the old version before the new one can be deployed.
As has already been pointed out, the debug keystore won't be the same on all installations of Xamarin.Android. Which is expected behavior.
When using Play Services you want to create a keystore, preferably one for debug and one for release, or as different aliases in the same keystore (you figure that out).
Then you can make the build process automagically sign your app by adding some stuff to your .csproj file. You can read more about this in the docs.
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<AndroidKeyStore>True</AndroidKeyStore>
<AndroidSigningKeyStore>public.keystore</AndroidSigningKeyStore>
<AndroidSigningStorePass>MyKeystorePassword</AndroidSigningStorePass>
<AndroidSigningKeyAlias>MyKey</AndroidSigningKeyAlias>
<AndroidSigningKeyPass>MyKeyPassword</AndroidSigningKeyPass>
</PropertyGroup>
You can make a similar block for Debug as well choosing either another alias or another keystore.
Yes, debug keystore is part of the Xamarin installation and it changes if you reinstall Xamarin. You need to update the key signature on Google console, this time create a keystore and keep it hidden, keep it safe (so to speak).

android LicenseValidator : Signature verification failed

I'm having a problem with the LVL in one app.
We have around 10 Apps in that we are using License check, but today only one App is not working. Its showing Signature Verification Failed error. All 10 apps are using the same licensing library, apart from one app all are working perfectly fine. Not getting why its not working. The Key I'm using is definitely correct!
The error I get in logcat is:
12-12 15:22:07.000: E/LicenseValidator(6783): Signature verification failed.
And the dontAllow() function of the LicenseCheckerCallback is run.
I'm testing the apps on a Nexus One.
1st, double check the BASE64_PUBLIC_KEY in the app against the Developer Console -> Development Tools -> Services & APIs Base-64 code.
2nd, do not change the versionCode in the gradle files until you are ready to "Build -> Generate Signed APK" and upload it to the store. Version codes that haven't been used in uploaded previous versions come back unlicensed.
3rd, make sure that the user, who is signed in on the device, does have a license (either real or tester).
4th, make sure that the internet connection works on the device.
The problem for me was that I changed the versionCode in my AndroidManifest file, but the new version was not know to the Google developer console. After uploading the new apk, the error disappeared.
This is kind of a bizarre solution but it worked for me:
I logged into the Android Developer Console, navigated to the Edit Profile screen, and reset my License Test Response to a different value. After saving, I reset the test response back to what it was before and saved again. After I did that, the error disappeared and everything worked fine.
In my experience, the test response stuff is very brittle. I've seen it reply with incorrect stuff, even when using StrictPolicy. This blog post mirrored my experience exactly:
Android License Test Response - Never Works

Categories

Resources