Tôi đã gặp rắc rối với vấn đề này trong tuần này. Đã tìm kiếm các chủ đề tương tự về vấn đề này nhưng vẫn không thể giải quyết được vấn đề của tôi.Dịch vụ của Google Play đã lỗi thời. Yêu cầu 11011000 nhưng tìm thấy 10289574
Các Prolem là khi tôi đang cố gắng chạy chương trình của tôi trên Polar m600 mặc hoặc giả lập mặc (Android V 7.1.1 và API25) they'r cho tôi thông báo này "Google Play dịch vụ lỗi thời. Yêu cầu 11011000 nhưng tìm thấy 10289574 ".
Tôi đã theo dõi phần "Nhận vị trí được biết cuối cùng" trong trang web dành cho nhà phát triển Android. (Link cho các trang web https://developer.android.com/training/location/retrieve-current.html#play-services)
Đây là mã MainActivity của tôi mà tôi đang sử dụng
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) {
}
}
});
}
}
Dưới đây là manifest.xml` tôi
<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>
Và cuối cùng nhưng không kém phần quan của tôi 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'}
Kiểm tra https://stackoverflow.com/a/41104004/3111083 –