title: Unresolved class 'MyFirebaseMessagingService' Android Studio
body: <p>I have problem with Firebase in Android studio.
  Here is what happen:
  In debug mod everything is working fine with follow AndroidManifest</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.hajora.dndcommerce"
  android:installLocation="auto"
  android:versionCode="2"
  android:versionName="1.0"
  xmlns:tools="http://schemas.android.com/tools"&gt;
  &lt;uses-sdk
      android:minSdkVersion="11"
      android:targetSdkVersion="21"
      tools:overrideLibrary="com.google.firebase.messaging"
      /&gt;
  &lt;supports-screens
      android:largeScreens="true"
      android:normalScreens="true"
      android:smallScreens="true"
      android:xlargeScreens="true"
      android:anyDensity="true"
   /&gt;
  &lt;uses-permission android:name="android.permission.CALL_PHONE"  /&gt;
  &lt;uses-feature android:name="android.hardware.telephony" android:required="false" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  
  &lt;application
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:theme="@style/AppTheme" &gt;
      &lt;activity
          android:name="com.hajora.dndcommerce.Education"
          android:label="@string/app_name"&gt;
      &lt;/activity&gt;
      &lt;activity android:name="com.hajora.dndcommerce.Splashscreen"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;action android:name="com.google.firebase.MESSAGING_EVENT"/&gt;
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;activity android:name="com.hajora.dndcommerce.SingleItemViewEducation" /&gt;
      &lt;activity android:name="com.hajora.dndcommerce.SingleItemViewNews" /&gt;
      &lt;activity android:name="com.hajora.dndcommerce.Main" /&gt;
      &lt;activity android:name="com.hajora.dndcommerce.Submit" /&gt;
      &lt;activity android:name="com.hajora.dndcommerce.News" /&gt;
      &lt;activity android:name="com.hajora.dndcommerce.Contact" /&gt;
      &lt;activity android:name="com.hajora.dndcommerce.About" /&gt;
      &lt;activity android:name="com.hajora.dndcommerce.AboutCompany" /&gt;
      &lt;activity android:name="com.hajora.dndcommerce.AboutHistory" /&gt;
      &lt;activity android:name="com.hajora.dndcommerce.AboutVision" /&gt;
      &lt;activity android:name="com.hajora.dndcommerce.AboutPartners" /&gt;
      &lt;activity android:name="com.hajora.dndcommerce.Ask"
          android:windowSoftInputMode="stateUnchanged" /&gt;
      &lt;activity android:name=".Partner" /&gt;
  &lt;/application&gt;
      &lt;service
          android:name=".MyFirebaseMessagingService"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="com.google.firebase.MESSAGING_EVENT"/&gt;
          &lt;/intent-filter&gt;
      &lt;/service&gt;
      &lt;service
          android:name=".MyFirebaseInstanceIDService"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="com.google.firebase.INSTANCE_ID_EVENT"/&gt;
          &lt;/intent-filter&gt;
      &lt;/service&gt;
  </code></pre>
  
  <p></p>
  
  <p>When i switch to release mode, i get the error:</p>
  
  <pre><code>Error:(54) Error: The &lt;service&gt; element must be a direct child of the &lt;application&gt; element [WrongManifestParent]
  </code></pre>
  
  <p>So, i then put both services inside  tag and after that i get the error:</p>
  
  <pre><code>Unresolved class 'MyFirebaseMessagingService' less... (Ctrl+F1) 
  </code></pre>
  
  <p>Validates resource references inside Android XML files.</p>
  
  <p>I cannot figure what is the problem</p>
  
  <p>UPDATE
  gradle</p>
  
  <pre><code>    apply plugin: 'com.android.application'
  
  android {
  
      compileSdkVersion 21
      buildToolsVersion "26.0.0"
      defaultConfig {
          applicationId 'com.hajora.dndcommerce'
          minSdkVersion 21
          targetSdkVersion 21
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
              signingConfig signingConfigs.release
          }
      }
      productFlavors {
      }
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_7
          targetCompatibility JavaVersion.VERSION_1_7
      }
  }
  
  dependencies {
      compile files('libs/activation.jar')
      compile files('libs/mail.jar')
      compile files('libs/additionnal.jar')
      compile 'com.google.firebase:firebase-messaging:10.0.1'
      compile 'com.android.support.constraint:constraint-layout:1.0.2'
      compile 'com.google.firebase:firebase-core:10.0.1'
  }
  apply plugin: 'com.google.gms.google-services'
  </code></pre>