Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcm_defaultSenderId can't be resolved

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.

  1. How can I remove this error & make my app run?

  2. If I've to install gradle, which plugin should I use in my Eclipse-MARS?

PS - I've never used gradle before.

like image 942
adam black Avatar asked Dec 06 '22 20:12

adam black


1 Answers

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.

like image 60
Manish Chawla Avatar answered Dec 11 '22 10:12

Manish Chawla