【问题标题】:Google Play services out of date. Requires 11011000 but found 10289574Google Play 服务已过时。需要 11011000 但找到 10289574
【发布时间】:2017-06-16 08:42:34
【问题描述】:

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

问题是,当我尝试在 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


【解决方案1】:

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

然后点击模拟器中的 3 个点,这将打开扩展窗口,点击 Google Play + 更新。这会将 Google Play 服务更新到今天 11.0.55 的最新更新。

【讨论】:

  • 这是正确答案!谢谢。仅供参考,您必须使用 Google 帐户登录模拟器才能更新
  • Wear 模拟器在设置中没有“Google Play”标签
  • 在 android 模拟器 Nexus 5x 上更新时出现错误。错误如下“无法登录,与谷歌服务器通信时出现问题。稍后再试”
  • 这个答案对我有帮助,但是如果我们想要测试除了 nexus 5x 和 nexus 5 之外的测试呢?我的意思是其他模拟器的解决方案是什么?
  • 因为这个选项在我的模拟器中不可用。我在 Android SDK 中更新了 Google Play 服务。然后它起作用了。
【解决方案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'

【讨论】:

    【解决方案3】:

    我的解决方案非常奇怪: 转到设置 -> 应用程序 -> 系统应用程序 -> Google Play 商店 我的版本是 10xxxx,这很奇怪,因为我的手表在启动时更新了。于是,我点击了Remove Update,版本就变成了11xxxxxx。

    【讨论】:

      【解决方案4】:

      这里的问题是模拟器和gradle文件上的google play服务(版本)不匹配。

      可以通过两种方式解决:

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

      2. 在模拟器上升级 Google Play 服务

      【讨论】:

      • 如何在模拟器上升级 Google Play 服务?
      【解决方案5】:

      正如 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();
      }
      

      【讨论】:

        【解决方案6】:

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

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

        作为参考,以下是 Play Services 的发布历史:https://developers.google.com/android/guides/releases

        【讨论】:

          【解决方案7】:

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

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

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

          【讨论】:

            【解决方案8】:

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

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 2013-07-25
              • 2013-02-15
              • 2019-09-23
              • 2015-08-26
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              相关资源
              最近更新 更多