title: gms.analytics.GoogleAnalytics - NoClassDefFoundError
body: <p><strong>My Aplication Class</strong></p>
  
  <pre><code>public class MyApplication extends Application {
  
  private static final String PROPERTY_ID = "UA-XXXXXX-X";
  public static int GENERAL_TRACKER = 0;
  
  public enum TrackerName {
      APP_TRACKER, // Tracker used only in this app.
      GLOBAL_TRACKER, // Tracker used by all the apps from a company. eg:
                      // roll-up tracking.
      ECOMMERCE_TRACKER, // Tracker used by all ecommerce transactions from a
                          // company.
  }
  
  HashMap&lt;TrackerName, Tracker&gt; mTrackers = new HashMap&lt;TrackerName, Tracker&gt;();
  
  public MyApplication() {
      super();
  }
  
  public synchronized Tracker getTracker(TrackerName trackerId) {
      if (!mTrackers.containsKey(trackerId)) {
  
          GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
          analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
          Tracker t = (trackerId == TrackerName.APP_TRACKER) ? analytics
                  .newTracker(PROPERTY_ID)
                  : (trackerId == TrackerName.GLOBAL_TRACKER) ? analytics
                          .newTracker(R.xml.global_tracker) : analytics
                          .newTracker(R.xml.ecommerce_tracker);
          mTrackers.put(trackerId, t);
  
      }
      return mTrackers.get(trackerId);
    }
  }
  </code></pre>
  
  <p><strong>app_tracker.xml</strong></p>
  
  <p>
  </p>
  
  <pre><code>&lt;string name="ga_trackingId"&gt;UA-XXXXXX-X&lt;/string&gt;
  &lt;string name="ga_sampleFrequency"&gt;100&lt;/string&gt;
  
  &lt;bool name="ga_autoActivityTracking"&gt;true&lt;/bool&gt;
  &lt;bool name="ga_reportUncaughtExceptions"&gt;true&lt;/bool&gt;
  
  &lt;integer name="ga_sessionTimeout"&gt;-1&lt;/integer&gt;
  
  &lt;screenName name="com.mobihouse.portabilidade.activities.HomeActivity_"&gt;HomeActivity&lt;/screenName&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>global_tracker.xml</strong></p>
  
  <p>
  </p>
  
  <pre><code>&lt;integer name="ga_sessionTimeout"&gt;300&lt;/integer&gt;
  
  &lt;!-- Enable automatic Activity measurement --&gt;
  &lt;bool name="ga_autoActivityTracking"&gt;true&lt;/bool&gt;
  
  &lt;string name="ga_logLevel"&gt;verbose&lt;/string&gt;
  
  &lt;!-- The screen names that will appear in reports --&gt;
  &lt;screenName name="com.mobihouse.portabilidade.activities.HomeActivity_"&gt;HomeActivity Portabilidade&lt;/screenName&gt;
  &lt;!-- The following value should be replaced with correct property id. --&gt;
  &lt;string name="ga_trackingId"&gt;UA-XXXXXX-X&lt;/string&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>At my Manifest, i already added this:</strong></p>
  
  <pre><code>    &lt;application
      android:name="com.mobihouse.portabilidade.MyApplication"
  
      &lt;meta-data
          android:name="com.google.android.gms.version"
          android:value="@integer/google_play_services_version" /&gt;
  
      &lt;meta-data
          android:name="com.google.android.gms.analytics.globalConfigResource"
          android:resource="@xml/global_tracker" /&gt;
  </code></pre>
  
  <p><em>I changed my PROPERTY_ID to post here.</em></p>
  
  <p><strong>And the problem is, log:</strong></p>
  
  <blockquote>
    <p>11-25 09:23:30.031: E/AndroidRuntime(8392): FATAL EXCEPTION: main
    11-25 09:23:30.031: E/AndroidRuntime(8392):
    java.lang.NoClassDefFoundError:
    com.google.android.gms.analytics.GoogleAnalytics 11-25 09:23:30.031:
    E/AndroidRuntime(8392):   at
    com.mobihouse.portabilidade.MyApplication.getTracker(MyApplication.java:45)</p>
  </blockquote>
  
  <p><strong>And:</strong></p>
  
  <blockquote>
    <p>11-25 09:23:29.992: I/dalvikvm(8392): Could not find method
    com.google.android.gms.analytics.Tracker.setScreenName, referenced
    from method
    com.mobihouse.portabilidade.activities.HomeActivity.onCreate</p>
    
    <p>11-25 09:23:29.992: I/dalvikvm(8392): Could not find method
    com.google.android.gms.analytics.GoogleAnalytics.getInstance,
    referenced from method
    com.mobihouse.portabilidade.activities.HomeActivity.onStart</p>
  </blockquote>
  
  <p>I searched several sites, however all solutions not worked, someone could help me?</p>
  
  <p>I already update the google play services lib, my current version = 21, according to ADB Manager, I am trying to implement in Android 5.0 - API 21.</p>
  
  <p>Also I already put the google play services as a lib in my project</p>