Reputation: 607
I'm trying to run GCM
sample application present here in my Eclipse.
I'm not using Android studio and I don't have gradle
plug-in in my eclipse.
After importing the GCM
client android app in eclipse, I'm getting error:
gcm_defaultSenderId cannot be resolved or is not a field
I do not want to shift to Android studio.
How can I remove this error & make my app run?
If I've to install gradle, which plugin should I use in my Eclipse-MARS?
PS - I've never used gradle before.
Upvotes: 5
Views: 6886
Reputation: 169
Follow the steps to get it resolved:
1.) Log in to Google Developer site URL : https://developers.google.com/cloud-messaging/android/start
2.) Click "GET A CONFIGURATION FILE" button under Step #2
3.) Provide a App name and the appropriate package name.
4.) Click "Continue to choose and configure services" button.
5.) Select "Cloud Messaging" and click "ENABLE GOOGLE CLOUD MESSAGING" button.
6.) Download the google-services.json file.
7.) Open the file and get the "project_number" value under "project_info".
8.) Open Eclipse and add the following entry under ../res/values/strings.xml
file. Replace the PROJECT_ID with the value extracted from Step 7.
<string name="gcm_defaultSenderId">PROJECT_ID</string>
9.) Clean and Build, it should work.
Upvotes: 16