title: Google Play Service FATAL ERROR
body: <p>In my project I use GCM for push notification from server.</p>
  
  <p>I foollow instruction <a href="https://developers.google.com/android/guides/setup" rel="nofollow">https://developers.google.com/android/guides/setup</a> to add Google Play Service in my project.</p>
  
  <p>And everything work fine on my device (Galaxy NOTE S3), but when I start testing on another emulators (include genymotion) I got FATAL ERROR:</p>
  
  <pre><code>FATAL EXCEPTION: main
  java.lang.NoClassDefFoundError: com.google.android.gms.R$string
  at com.google.android.gms.measurement.zza.&lt;init&gt;(Unknown Source)
  at com.google.android.gms.measurement.zza.zzaR(Unknown Source)
  at com.google.android.gms.measurement.internal.zzn.zziJ(Unknown Source)
  at com.google.android.gms.measurement.internal.zzz.zza(Unknown Source)
  at com.google.android.gms.measurement.internal.zzw.&lt;init&gt;(Unknown Source)
  at com.google.android.gms.measurement.internal.zzaa.zzDj(Unknown Source)
  at com.google.android.gms.measurement.internal.zzw.zzaT(Unknown Source)
  at com.google.android.gms.measurement.AppMeasurementContentProvider.onCreate(Unknown Source)
  at android.content.ContentProvider.attachInfo(ContentProvider.java:1058)
  at android.app.ActivityThread.installProvider(ActivityThread.java:4560)
  at android.app.ActivityThread.installContentProviders(ActivityThread.java:4190)
  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4132)
  at android.app.ActivityThread.access$1300(ActivityThread.java:130)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:137)
  at android.app.ActivityThread.main(ActivityThread.java:4745)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:511)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>I check availability by method:</p>
  
  <pre><code>public static boolean checkPlayServices(Activity activity) {
  
      GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
      int resultCode = apiAvailability.isGooglePlayServicesAvailable(activity);
      if (resultCode != ConnectionResult.SUCCESS) {
          if (apiAvailability.isUserResolvableError(resultCode)) {
              apiAvailability.getErrorDialog(activity, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST)
                      .show();
          }
          return false;
      }
      return true;
  
  }
  </code></pre>
  
  <p>And call this method in onResume of MainActitvity.class:</p>
  
  <pre><code>@Override
  protected void onResume() {
      super.onResume();
  
      if(SMSSenderHelper.checkPlayServices(this)){
          startService(new Intent(this, RegistrationIntentService.class));
      }else{
          finish();
      }
  }
  </code></pre>
  
  <p><strong>SOLUTION (in my case):</strong></p>
  
  <ol>
  <li>review your build.gradle</li>
  <li><p>change Application class:</p>
  
  <p>@Override
  protected void attachBaseContext(Context base) {
      super.attachBaseContext(base);
      MultiDex.install(this);
  }</p></li>
  </ol>