title: XML error when adding Google Analytics into my app
body: <p>i want to attach google analytics google analytics in my app.</p>
  
  <p>i'm following how to adding google analytics in the google GA homepages.
  (<a href="https://developers.google.com/analytics/devguides/collection/android/v4/#manifest" rel="noreferrer">https://developers.google.com/analytics/devguides/collection/android/v4/#manifest</a>)</p>
  
  <p>but I have an error in ApplicationTracker.java</p>
  
  <p>in R.xml.global_tracker and R.xml.ecommerce_tracker, xml have a red line(have an error)</p>
  
  <p>and error content is "xml cannot be resolved or is not a field"</p>
  
  <p>i'm aleady deal with googling and stackoverfliw searching and so many searching.</p>
  
  <p>and many people say this is about android.R</p>
  
  <p>but i'm not add android. i'm use com.myPackageName.R well.</p>
  
  <p>Can somebody explain this please ? </p>
  
  <p>behind is my code</p>
  
  <p>ApplicationTracker.java
  <div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
  <div class="snippet-code snippet-currently-hidden">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>package com.zla.android;
  
  import java.util.HashMap;
  import android.app.Application;
  import com.google.android.gms.analytics.GoogleAnalytics;
  import com.google.android.gms.analytics.Tracker;
  import com.zla.android.R;
  
  public class ApplicationTrackers extends Application{
  
   private static final String PROPERTY_ID = "UA-XXXXXXXX-2";
  
   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;();
   
   synchronized Tracker getTracker(TrackerName trackerId) {
    if (!mTrackers.containsKey(trackerId)) {   
     GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
     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>
  </div>
  </div>
  </p>
  
  <p>global_tracker.xml</p>
  
  <p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
  <div class="snippet-code snippet-currently-hidden">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="TypographyDashes"&gt;
   
   &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;!-- The screen names that will appear in reports --&gt;
      &lt;string name="com.zla.android.MainActivity"&gt;MainActivity&lt;/string&gt;
      
      &lt;string name="ga_trackingId"&gt;UA-XXXXXXXX-2&lt;/string&gt;
  &lt;/resources&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>ecommerce_tracker.xml</p>
  
  <p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
  <div class="snippet-code snippet-currently-hidden">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources&gt;
   &lt;integer name="ga_sessionTimeout"&gt;300&lt;/integer&gt;
   &lt;string name="ga_trackingId"&gt;UA-XXXXXXXX-2&lt;/string&gt;    
  &lt;/resources&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>AndroidManifest.xml</p>
  
  <p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
  <div class="snippet-code snippet-currently-hidden">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.zla.android"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="16"
          android:targetSdkVersion="21" /&gt;
      
      &lt;!-- about google analytics --&gt;
   &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
   &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
    
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/app_icon"
          android:label="@string/app_name"
          android:theme="@style/AppTheme"
          android:largeHeap="true"  &gt;
  
          &lt;activity
              android:name=".MainActivity"
              android:label="@string/app_name" &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;activity
              android:name="com.zla.android.SearchBrandActivity"
              android:label="search page" /&gt;
          
          &lt;activity
              android:name="com.zla.android.SearchFrameActivity"
              android:label="search page" /&gt;
          
          &lt;activity
              android:name="com.zla.android.ListActivity"
              android:label="list page"
              android:parentActivityName="com.zla.android.MainActivity" &gt;
          &lt;/activity&gt;
          
          &lt;activity
              android:name="com.zla.android.ListActivity_WishList"
              android:label="list page"
              android:parentActivityName="com.zla.android.MainActivity" &gt;
          &lt;/activity&gt;
          
          &lt;activity
              android:name="com.zla.android.DetailActivity"
              android:label="detail page"
              android:parentActivityName="com.zla.android.ListActivity" /&gt;
          
          &lt;!-- about google analytics --&gt;
          &lt;meta-data
     android:name="com.google.android.gms.version"
     android:value="@integer/google_play_services_version" /&gt;
                  
          &lt;activity
              android:name="com.zla.android.ApplicationTrackers"
              android:label="google analytics"
              android:parentActivityName="com.zla.android.MainActivity" /&gt;
          
      &lt;/application&gt;
  
  &lt;/manifest&gt;</code></pre>
  </div>
  </div>
  </p>