Reputation: 2223
I am trying to implement Google Analytics in my app,
I have already created a global_tracker.xml file containing the basic configuration and my Property-ID.
I have added the meta-data tag to my AndroidManifest.xml:
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
These are the dependencies in my build.gradle file:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:21.0.0'
compile 'com.google.android.gms:play-services:6.1.+'
}
I have created a class to store my tracker Enum as instructed in the Google Analytics SDK V4 Guide
But even after all of these steps, when attempting to import:
import com.google.android.gms.analytics.Logger;
import com.google.android.gms.analytics.Tracker;
import com.google.android.gms.analytics.GoogleAnalytics;
I get an error saying "Cannot resolve symbol 'analytics' directing me to my import lines.
I have tried searching on the internet and in SO for a solution but didn't succeed.
What am I missing?
Upvotes: 1
Views: 1574
Reputation: 2223
Eventully I found out what the issue was, my Android Studio project name had an exclamation mark (!) in it, causing the google play services to fail to attach itself to the project, making me unable to use the Google Analytics Library, aswell as other .jar files I wanted to add manually.
Long story short, use the tips Android Studio displayes when you create a new project: avoid spaces and special characters when creating your project and developing it, as it might fail to work as expected
Upvotes: 2