Android 谷歌播放服务已经过时。需要12800000,但找到8703448
我的应用程序使用以下依赖项Android 谷歌播放服务已经过时。需要12800000,但找到8703448,android,google-play-services,Android,Google Play Services,我的应用程序使用以下依赖项 implementation 'com.google.android.gms:play-services-auth:16.0.1' 它连接到谷歌Api以获取设备位置并将数据存储在谷歌智能锁中 除了在安卓6上运行的一台设备上,它工作正常。 尝试连接到Google Api时,出现以下错误: ConnectionResult{statusCode=需要服务版本更新 W/GooglePlayServicesUtil:Google Play服务已过时。需要 12800000,
implementation 'com.google.android.gms:play-services-auth:16.0.1'
它连接到谷歌Api以获取设备位置并将数据存储在谷歌智能锁中
除了在安卓6上运行的一台设备上,它工作正常。
尝试连接到Google Api时,出现以下错误:
ConnectionResult{statusCode=需要服务版本更新
W/GooglePlayServicesUtil:Google Play服务已过时。需要
12800000,但发现8703448
我不能回到以前版本的play services lib,因为Android Studio说
错误:所有firebase库必须高于或低于14.0.0
我应该怎么做才能让应用程序在Google Play services过期版本的设备上运行?我通过使用此代码更新Google Play services版本解决了此错误
//On button click of the google signIn
googleSignIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signInIntent,GOOGLE_SIGNIN_ID);
}
//onActivity Result code.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent
data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == GOOGLE_SIGNIN_ID){
Task<GoogleSignInAccount> googleSignInAccountTask = GoogleSignIn.getSignedInAccountFromIntent(data);
try {
GoogleSignInAccount googleSignInAccount = googleSignInAccountTask.getResult(ApiException.class);
fireBaseAuthenticationWithGoogle(googleSignInAccount);
}catch (ApiException e){
//if user doesn't have updated google play services version
if (e.getStatusCode() == 12500){
try{
// show your own AlertDialog for example:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
// set the message
builder.setMessage("This app uses google play services for signing in")
.setTitle("Do you want to update?");
builder.setPositiveButton("Ok", (dialog, id) -> {
//final String appPackageName = "com.google.android.gms";
final String appPackageName = "com.google.android.gms&hl=en_IN";
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
}catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User cancelled the dialog
}
});
AlertDialog dialog = builder.create();
dialog.show();
}catch (Exception err){
err.printStackTrace();
}
}
}
}
把这个放在例外的地方。我希望它对@matdev有帮助。你可以显示对话框来更新google play services@matdev。怎么做?没有其他选择?我已经使用firebase在我的应用程序中实现了google登录。没有更新google play services的用户无法登录google。因此我研究了一个新的问题我唯一的选择是让用户更新播放版本。我的问题是,如果firebase不允许登录,我们没有选择余地,除非我们更新app@matdevHave你在根级别的“build.gradle”文件中签了名吗?谢谢@g.brahma Datta如何安装Google play服务的版本号?如果你将其作为答案发布,我会告诉你接受它。你能在API中输入查询代码以了解安装的Google Play Services的版本吗?我得到了错误12500,这是因为没有更新最新的Play Services版本。在研究了它之后,我知道Play Services版本是在我编写代码之后更新的,我更新了Play Services的版本d能够登录到应用程序。这与您询问的问题类似@matdev您可以编写此代码,其中出现异常@matdev您可以使用GooglePlayServicesUtil.GOOGLE\u PLAY\u SERVICES\u version\u code查找已安装的GOOGLE PLAY SERVICES版本是,但您无法跟踪每次生产时的更新版本。I如果应用程序google play版本低于更新版本,则可以保留该条件,然后使用我发布的@matdev代码