2017-06-16 25 views
15

我一直在解决这个问题,一周左右吧。一直在寻找类似的话题,但仍然无法解决我的问题。Google Play服务已过期。需要11011000,但找到了10289574

Prolem是,当我试图运行我的程序在Polar m600磨损或磨损模拟器(Android V 7.1.1和API25)他们给我这个消息“谷歌播放服务过时了。需要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'} 
+0

检查此https://stackoverflow.com/a/41104004/3111083 –

回答

0

多年来,这一直是Wear的一个持续性问题(请参阅Android Wear Google Play Services)。

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

仅供参考,这里是游戏服务发布历史:https://developers.google.com/android/guides/releases

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' 
22

创建模拟器的Nexus 5X与Android版本O - API 26 - 86或Android版本的牛轧糖 - API 24 - 86 Nexus 5x

enter image description here

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

enter image description here

+2

这是正确的答案!谢谢。仅供参考,您必须使用Google帐户登录模拟器才能更新 – JCricket

+4

Wear模拟器在设置中没有“Google Play”选项卡 – ken

+0

您是对的。抱歉。 –

1

我的解决办法是超级怪异: 转到设置 - >应用程序 - >系统应用 - >谷歌Play商店 我的版本是10xxxxx因为我的手表更新启动是怪异。所以,我点击删除更新,版本更改为11xxxxxx。

0

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

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

  1. 删除不匹配的降级谷歌的版本gradle文件播放服务 (版本)到谷歌玩模拟器的服务(版本) 。

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

相关问题