The application stopped unexpectdly 
<p>I had this message when running the project:</p>

<pre>
Unfortunately the project stopped 
</pre>

<p>also when I add the code between try and catch I had this error </p>

<pre>
application dosenot define permission com.example.elarabygroup.permission.c2d MESSAGE
</pre>

<p>I tested all codes and I found the error to be here:</p>

<pre><code>public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_elaraby_group);

    GCMRegistrar.checkDevice(this);
    GCMRegistrar.checkManifest(this);
    final String regId = GCMRegistrar.getRegistrationId(this);

    if (regId.equals("")) {
        GCMRegistrar.register(this, SENDER_ID);
    } else {
        Log.v(TAG, "Already registered");
    }
}
</code></pre>

<p>manifest</p>

<pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.elarabygroup"
    android:versionCode="1"
    android:versionName="1.0" &gt;

    &lt;uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" /&gt;

    &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;

    &lt;!-- App receives GCM messages. --&gt;
&lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /&gt;
&lt;!-- GCM connects to Google Services. --&gt;
&lt;uses-permission android:name="android.permission.INTERNET" /&gt; 
&lt;!-- GCM requires a Google account. --&gt;
&lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt;
&lt;!-- Keeps the processor from sleeping when a message is received. --&gt;
&lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;

    &lt;application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" &gt;
        &lt;activity
            android:name=".ElarabyGroup"
            android:label="@string/title_activity_elaraby_group" &gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN" /&gt;

                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
        &lt;receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" &gt;
  &lt;intent-filter&gt;
    &lt;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt;
    &lt;action android:name="com.google.android.c2dm.intent.REGISTRATION" /&gt;
    &lt;category android:name=".ElarabyGroup" /&gt;
  &lt;/intent-filter&gt;
&lt;/receiver&gt;
&lt;service android:name=".GCMIntentService" /&gt;
    &lt;/application&gt;


&lt;/manifest&gt;
</code></pre>

<p>GCMIntentService  class</p>

<pre><code>package com.example.elarabygroup;

import com.google.android.gcm.GCMBaseIntentService;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class GCMIntenetService extends GCMBaseIntentService {
    public static String TAG = "GCMIntentService";

    public GCMIntenetService(String senderId) {
        super(senderId);
        Log.d("GCMIntentService", senderId);
    }

    @Override
    protected void onError(Context arg0, String arg1) {
        Log.d("onError", arg1);
    }

    @Override
    protected boolean onRecoverableError(Context context, String errorId) {
        Log.d("onRecoverableError", errorId);
        return false;
    }

    @Override
    protected void onMessage(Context arg0, Intent arg1) {
        Log.d("onMessage", String.valueOf(arg1));
    }

    @Override
    protected void onRegistered(Context arg0, String arg1) {
        Log.d("onRegistered", arg1);
    }

    @Override
    protected void onUnregistered(Context arg0, String arg1) {
        Log.d("onUnregistered", arg1);
    }
}
</code></pre>
