2
votes

I am using google cloud message in my Android application. I follow the step here

When i run the app, logcat show the warning messages:

E/GMPM: GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services. Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.

E/GMPM: Scheduler not set. Not logging error/warn.

E/GMPM: Uploading is not possible. App measurement disabled

But I still can get the token, when i use Google gcm sample code to test push(gcmsender), it is working fine (I can receive the push), I added the configuration file generated by Google called "google-services.json" to my project, and my app gradle :

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'}

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

My project gradle:

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'
    classpath 'com.google.gms:google-services:1.3.0-beta4'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

I can not figure out why the warning messages shows on logcat, i follow the step and app works fine, does anyone know?

EDIT: problem solved, just add your app id in string.xml file, Google console

find "project_id", and copy to your string.xml

<!-- App id -->
<string name="google_app_id">your project id</string>
1
have you tried to define google_app_id in your string.xml file? - justDroid
No, what is google_app_id? I did not find this in GCM guide page - user3814793
just define your app id to which you will get from google console. - justDroid
Wow! warning disappeared! thank you! - user3814793
welcome. :) my pleasure it helped you - justDroid

1 Answers

0
votes

Add your app id(get it from google console) and add it to string.xml

<!-- App id -->
<string name="google_app_id">appId</string>