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

Fou*_*l.H 28 android android-wear-2.0 wear-os

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

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) {

                    }
                }
            });

}
}
Run Code Online (Sandbox Code Playgroud)

这是我的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>
Run Code Online (Sandbox Code Playgroud)

最后但并非最不重要的是我的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'}
Run Code Online (Sandbox Code Playgroud)

Uri*_*kel 51

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

在此输入图像描述

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

在此输入图像描述

  • Wear模拟器在设置中没有"Google Play"标签 (5认同)
  • 这是正确的答案!谢谢.仅供参考,您必须使用Google帐户登录模拟器进行更新 (4认同)

Str*_*ing 0

这一直是 Wear 多年来一直存在的问题(例如,请参阅Android Wear Google Play 服务)。

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

作为参考,以下是 Play 服务发布历史记录:https ://developers.google.com/android/guides/releases