client - Cannot resolve com.google.android.gcm.GCMBaseIntentService; Android studio -


edit: solved problem:) cause of error :

  1. in tutorial implementing gcm client , there link download full source code demo.
  2. downloaded reference , added google_play_service library in build.gradle.
  3. did recommended changes sender_id,server_url,.. etc
  4. synch project gradle , got error.

how solved!

  1. after lot of google found class not in google_play_service library in gcm.jar deprecated now. dont know why google has given link old code , explained latest code in document.
  2. then include gcm.jar
  3. and error gone, got push notification:)

hope got in trouble!

my old question

i new android studio. dont understand build.gradle. today implementing gcm-demo-client following instructions given here https://developer.android.com/google/gcm/client.html when import suggested open source code got below errors.

/home/shani/desktop/gcm-76908409d9d5/samples/gcm-demo-client1/app/src/main/java/com/google/android/gcm/demo/app/gcmintentservice.java:28: error: cannot find symbol import com.google.android.gcm.gcmbaseintentservice;                              ^   symbol:   class gcmbaseintentservice   location: package com.google.android.gcm 

also there other 25 errors. after search on google found because had not added google play service library in build.gradle.

then added library: below build.gradle file

apply plugin: 'com.android.application'  android {     compilesdkversion 21     buildtoolsversion "21.1.2"      defaultconfig {         applicationid "com.google.android.gcm.demo.app"         minsdkversion 8         targetsdkversion 16     }      buildtypes {         release {             minifyenabled false             proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.txt'         }         dependencies {             compile "com.google.android.gms:play-services:3.1.+"         }     } } 

now when click on sync link got build success. when try run on real device above error comes. dont know doing wrong. please give me solution, spend 2 days implementing gcm demo app.

i think problem gradle not downloading dependency. had same problem solved when invalidated cache , restarted android studio. click on file > invalidate cache/restart


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -