android - Google Play 服务已过时。需要 11011000 但找到 10289574

标签 android wear-os android-wear-2.0

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

问题是,当我尝试在 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 版本 O - api 26 - x86 或 Android 版本 Nougat - api 24 - x86 创建模拟器 Nexus 5x Nexus 5x

enter image description here

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

enter image description here

关于android - Google Play 服务已过时。需要 11011000 但找到 10289574,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44584698/

相关文章:

java - 在另一个类中获取 Android Volley 响应

java - Android Wear 无法唤醒屏幕

ios - 是否可以将数据从 Android Wear 2.0 watch 传递到 IOS(Iphone)应用程序?

java - ListView 禁用点击项

java - 为什么当我添加尖锐信号时,Java ReplaceAll with Regex 边界不起作用?

安卓穿戴: DataItem API vs Channel API

Android:如何在 android wear 的 toast 上显示我的长消息?

android-webview - Wear OS 2.0 - 有没有办法以编程方式处理 html、网页?

android - Android Wear 2 中的未读通知计数复杂化

android - 合并不同的 Android Studio 项目