当前位置: 动力学知识库 > 问答 > 编程问答 >

android studio - google play services not up to date

问题描述:

I am attempting to integrate google admob in my android studio app. I get the following messages in my log (I apologize for the formatting and would greatly appreciate any assistance):

05-30 01:23:47.389 19555-19555/com.example.livingstonlabs.whatsbest I/Ads: Starting ad request.

05-30 01:23:47.430 19555-25051/com.example.livingstonlabs.whatsbest W/GooglePlayServicesUtil: Google Play services out of date. Requires 9080000 but found 8489470

05-30 01:23:47.430 19555-25051/com.example.livingstonlabs.whatsbest W/Ads: Failed to connect to remote ad request service.

05-30 01:23:47.430 19555-25051/com.example.livingstonlabs.whatsbest W/Ads: Could not start the ad request service.

05-30 01:23:47.505 19555-19555/com.example.livingstonlabs.whatsbest W/GooglePlayServicesUtil: Google Play services out of date. Requires 9080000 but found 8489470

I am assuming my google play services are for some reason out of date but I cannot see why that would be. I ave "apply plugin: 'com.google.gms.google-services'" at the end.

build.gradle(project)

buildscript {

repositories {

jcenter()

}

dependencies {

classpath 'com.android.tools.build:gradle:2.1.0'

classpath 'com.google.gms:google-services:3.0.0'

// NOTE: Do not place your application dependencies here; they belong

// in the individual module build.gradle files

}

}

allprojects {

repositories {

jcenter()

}

}

task clean(type: Delete) {

delete rootProject.buildDir

}

apply plugin: 'com.android.application'

****build.gradle(Module:app)****

android {

compileSdkVersion 23

buildToolsVersion "23.0.3"

defaultConfig {

applicationId "com.example.livingstonlabs.whatsbest"

minSdkVersion 16

targetSdkVersion 23

versionCode 1

versionName "1.0"

}

buildTypes {

release {

minifyEnabled false

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

}

}

}

dependencies {

compile fileTree(dir: 'libs', include: ['*.jar'])

testCompile 'junit:junit:4.12'

compile 'com.android.support:appcompat-v7:23.4.0'

compile 'com.google.firebase:firebase-core:9.0.0'

compile 'com.google.firebase:firebase-database:9.0.0'

compile 'com.google.firebase:firebase-ads:9.0.0'

compile 'com.google.android.gms:play-services:9.0.0'

}

apply plugin: 'com.google.gms.google-services'

网友答案:

it means that the phone's installation of Google play is lower than the version you dictate in your manifest.

you will need to update your phone's google play service.

网友答案:

I had a similar problem today.

Go into the SDK Manager and under the tab 'SDK Platform' Choose android 6.0. In the bottom right of the panel, click "show package details"

Now under the section for 6.0 choose "Google APIs", and "Google APIs System Image(for the image you are using). After selecting these two objects reboot your emulator and it will update with the fix.

网友答案:

You need to update Google Play Services application. You can use GoogleApiAvailability to obtain Intent for launching recover process. GoogleApiAvailability use to verify Google Play Services APK is available and up-to-date on the device.

You may want to check at runtime whether the GooglePlayServices are up-to-date on the device or not. If not, simply show the appropriate errorDialog that will prompt the user to update it.

Integer resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity());
if (resultCode == ConnectionResult.SUCCESS) {
    //Do what you want
} else {
    Dialog dialog = GooglePlayServicesUtil.getErrorDialog(resultCode, getActivity(), 0);
    if (dialog != null) {
        //This dialog will help the user update to the latest GooglePlayServices
        dialog.show();
    }
}

Check the doc for further information: https://developers.google.com/android/guides/setup#add_google_play_services_to_your_project

分享给朋友:
您可能感兴趣的文章:
随机阅读: