Google Play服务已过期。需要11011000但找到10289574

问题描述 投票:26回答:9

我一周以来一直在努力解决这个问题。一直在搜索有关此问题的类似主题,但仍然无法解决我的问题。

Prolem是当我试图在Polar m600磨损或磨损模拟器(Android V 7.1.1和API25)上运行我的程序时,他们给我这条消息“Google Play服务已过时。需要11011000但找到了10289574” 。

我在android开发者网站上关注了“获取最后一个已知位置”部分。 (链接站点https://developer.android.com/training/location/retrieve-current.html#play-services

这是我正在使用的Mainactivity代码

public class MainActivity extends Activity {

private FusedLocationProviderClient mFusedLocationClient;
public Location mLastLocation;
private TextView mTextView;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
    stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
        @Override
        public void onLayoutInflated(WatchViewStub stub) {
            mTextView = (TextView) stub.findViewById(R.id.text);
        }
    });

    mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
    if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION)
            != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION)
            != PackageManager.PERMISSION_GRANTED) {
        return;
    }
    mFusedLocationClient.getLastLocation()
            .addOnSuccessListener(this, new OnSuccessListener<Location>() {
                @Override
                public void onSuccess(Location location) {
                    mLastLocation = location;
                    Log.d("Location is:",""+mLastLocation);

                    if (location != null) {

                    }
                }
            });

}
}

这是我的manifest.xml`

<uses-feature android:name="android.hardware.type.watch" />

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@android:style/Theme.DeviceDefault">
    <meta-data android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

最后但并非最不重要的是我的build.gradle

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "ims.fhj.at.testnavigators"
    minSdkVersion 21
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
     }
  }
 }

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:2.0.3'
compile 'com.google.android.gms:play-services-wearable:11.0.1'
compile 'com.google.android.gms:play-services:11.0.1'}
android wear-os android-wear-2.0
9个回答
47
投票

使用Android版O创建模拟器Nexus 5x - api 26 - x86或Android版Nougat - api 24 - x86 Nexus 5x

enter image description here

然后单击模拟器中的3个点,这将打开extanded窗口,点击Google Play +更新。这将使Google Play服务更新为今天的最新更新11.0.55。

enter image description here


2
投票

您必须在可穿戴gradle文件中降级API。

问题是您的设备没有最新的Google Play服务应用程序。

要修复它,请更改为:

compile 'com.google.android.gms:play-services-wearable:10.0.0'
compile 'com.google.android.gms:play-services:10.0.0'

2
投票

我的解决方案非常奇怪:转到设置 - >应用程序 - >系统应用程序 - > Google Play商店我的版本是10xxxxx这很奇怪,因为我的手表在启动时更新了。因此,我单击删除更新,版本更改为11xxxxxx。


1
投票

这里的问题是谷歌播放服务(版本)在模拟器和gradle文件上的不匹配。

它可以通过两种方式解决:

  1. 通过将gradle文件中的google play服务(版本)版本降级为模拟器的Google Play服务(版本)来消除不匹配。
  2. 在模拟器上升级Google Play服务。

0
投票

多年来,这一直是Wear的问题(例如参见Android Wear Google Play Services)。

最好的解决方案似乎是不使用最新的Play服务版本。一种选择是找到一个似乎涵盖目标生产设备的最低版本;在你的情况下,这听起来像10.2范围内的东西。或者,选择包含您需要的所有功能的最低版本(我个人使用的是9.8.0)。

作为参考,这里是Play服务发布历史:https://developers.google.com/android/guides/releases


0
投票

有时,当您传递错误的web-client-id值时,会发生此错误

val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestIdToken(**web-client-id here**)
                .requestEmail()
                .build()

Use the value in the OAuth client id section indicated Web client (auto created by google service)

使用OAuth客户端ID部分中指示的Web客户端(由Google服务自动创建)中的值


0
投票

正如String所写,播放服务未在设备上更新。不幸的是,在WearOS世界中,Play服务可能是最新的,但它们根本无法在可穿戴设备上使用。在这种情况下,您可以使用以下方法进行反应:

GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
int result = apiAvailability.isGooglePlayServicesAvailable(this);
if (result != ConnectionResult.SUCCESS) {
    ... 
} else {
     apiAvailability.getErrorDialog(this, result, REQUEST_CODE,this).show();
}

0
投票

您必须为模拟器使用的图像升级Google Play服务和API。看看这个答案,为我解决了(Android Studio 3.1):https://stackoverflow.com/a/49751932/2292056

© www.soinside.com 2019 - 2024. All rights reserved.