2

Please help, it's all the days that I work on this problem and used all possible solutions found on the web.

Requirements: Use juno eclipse, ADT 20 I have works with business GCM, I did a project a bit more complicated using the demo of Android developers (http://developer.android.com/guide/google/gcm/demo.html) And I realized that my application was in Crask each call class GCMRegistrar.

So I created a minimal exercise that will work if I unlock everything.

import com.google.android.gcm.GCMRegistrar;

    public class Manda extends Activity {

        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_manda);

        crash --->  GCMRegistrar.checkDevice(this);

            // while developing the app, then uncomment it when it's ready.

            GCMRegistrar.checkManifest(this);

        }

I attach the screenshot of the min exercise I added the gcm.jar library and I did all I found.

I am a new user than I can not post img but I put a public link of bropbox https://www.dropbox.com/s/dyi0y4sppz4rcq3/img%20GCM%20problem.zip

HaemEternal
  • 2,229
  • 6
  • 31
  • 50
alfo888_ibg
  • 1,847
  • 5
  • 25
  • 43

3 Answers3

1

As stated in Google's docs, you MUST add your AndroidManifast.xml file the following:

<service android:name="YOUR.PACKAGE.NAME.GCMIntentService" />

<receiver
            android:name="com.google.android.gcm.GCMBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

                <category android:name="YOUR_CATEGORY_NAME" />
            </intent-filter>
        </receiver>

Make sure you put your IntentService class in the right package.

In addition, how did you add the gcm.jar to you project? You need to create a "libs" folder in your project and put the jar there

Givi
  • 3,283
  • 4
  • 20
  • 23
  • 1
    Dealr Yuval, I took the manifest from http://developer.android.com/guide/google/gcm/gs.html. I have only one package in my simply project. I think the problem in in the library... I added: Build Path --> Libraris--> and i added the jar....the libs folder there is in my project of Default... However i putted in this folder too... – alfo888_ibg Oct 04 '12 at 19:40
  • But does your classes are located in the same packages as the example? – Givi Oct 04 '12 at 19:43
  • In addition, it looks like a build path error, where did you locate the gcm.jar file? – Givi Oct 04 '12 at 19:43
  • 1
    can I add some scranshop in dropbox? – alfo888_ibg Oct 04 '12 at 19:49
  • 1
    However my class is in the main package and my jar is in "..\workspace\SendGCM\libs" – alfo888_ibg Oct 04 '12 at 19:56
0

Solution 1:

  1. Check that you have put gcm.jar file inside libs and not lib folder.

Solution 2:

Mostly this is the problem.Follow below steps to resolve the problem:

  1. Right click on Project->Build Path-> Configure Build Path and then Order and Exports
  2. Now check the Android Private Libraries .The checkbox should check of required library.
  3. Refresh ,Clean and Run..here you go!
Passion
  • 662
  • 1
  • 11
  • 29
0

The problem was my emulator without Google Apis (Google Inc). If you are using android emulator you have to create emulator with Google Apis (Google Inc).

alfo888_ibg
  • 1,847
  • 5
  • 25
  • 43