client - Cannot resolve com.google.android.gcm.GCMBaseIntentService; Android studio -
edit: solved problem:) cause of error :
- in tutorial implementing gcm client , there link download full source code demo.
- downloaded reference , added google_play_service library in build.gradle.
- did recommended changes sender_id,server_url,.. etc
- synch project gradle , got error.
how solved!
- 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.
- then include gcm.jar
- 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
Post a Comment