Help me i build android error use plugin analytics


#1

My system information:

Cordova CLI: 5.0.0
Gulp version: CLI version 3.8.11
Gulp local: Local version 3.9.0
Ionic Version: 1.0.0
Ionic CLI Version: 1.6.4
Ionic App Lib Version: 0.3.8

i use plugin https://github.com/danwilson/google-analytics-plugin

install

cordova plugin add cordova-plugin-google-analytics@0.7.1

and i build android it show error

:compileDebugJava/Users/Mac/Desktop/moblie/ionic/Myapp/platforms/android/src/com/danielcwilson/plugins/analytics/UniversalAnalyticsPlugin.java:3: error: package com.google.android.gms.analytics does not exist
import com.google.android.gms.analytics.GoogleAnalytics;
^
/Users/Mac/Desktop/moblie/ionic/Myapp/platforms/android/src/com/danielcwilson/plugins/analytics/UniversalAnalyticsPlugin.java:4: error: package com.google.android.gms.analytics.Logger does not exist
import com.google.android.gms.analytics.Logger.LogLevel;
^
/Users/Mac/Desktop/moblie/ionic/Myapp/platforms/android/src/com/danielcwilson/plugins/analytics/UniversalAnalyticsPlugin.java:5: error: package com.google.android.gms.analytics does not exist
import com.google.android.gms.analytics.HitBuilders;
^
/Users/Mac/Desktop/moblie/ionic/Myapp/platforms/android/src/com/danielcwilson/plugins/analytics/UniversalAnalyticsPlugin.java:6: error: package com.google.android.gms.analytics does not exist
import com.google.android.gms.analytics.Tracker;
^
/Users/Mac/Desktop/moblie/ionic/Myapp/platforms/android/src/com/danielcwilson/plugins/analytics/UniversalAnalyticsPlugin.java:34: error: cannot find symbol
public Tracker tracker;
^
symbol: class Tracker
location: class UniversalAnalyticsPlugin
/Users/Mac/Desktop/moblie/ionic/Myapp/platforms/android/src/com/danielcwilson/plugins/analytics/UniversalAnalyticsPlugin.java:129: error: cannot find symbol
private void addCustomDimensionsToTracker(Tracker tracker) {
^
symbol: class Tracker
location: class UniversalAnalyticsPlugin
/Users/Mac/Desktop/moblie/ionic/Myapp/platforms/android/src/com/danielcwilson/plugins/analytics/UniversalAnalyticsPlugin.java:111: error: cannot find symbol
tracker = GoogleAnalytics.getInstance(this.cordova.getActivity()).newTracker(id);
^
symbol: variable GoogleAnalytics
location: class UniversalAnalyticsPlugin
/Users/Mac/Desktop/moblie/ionic/Myapp/platforms/android/src/com/danielcwilson/plugins/analytics/UniversalAnalyticsPlugin.java:114: error: cannot find symbol
GoogleAnalytics.getInstance(this.cordova.getActivity()).setLocalDispatchPeriod(30);
^
symbol: variable GoogleAnalytics
location: class UniversalAnalyticsPlugin
/Users/Mac/Desktop/moblie/ionic/Myapp/platforms/android/src/com/danielcwilson/plugins/analytics/UniversalAnalyticsPlugin.java:135: error: package HitBuilders does not exist
.AppViewBuilder()
^
/Users/Mac/Desktop/moblie/ionic/Myapp/platforms/android/src/com/danielcwilson/plugins/analytics/UniversalAnalyticsPlugin.java:151: error: package HitBuilders does not exist
.AppViewBuilder()
^
/Users/Mac/Desktop/moblie/ionic/Myapp/platforms/android/src/com/danielcwilson/plugins/analytics/UniversalAnalyticsPlugin.java:170: error: package HitBuilders does not exist
.EventBuilder()
^
/Users/Mac/Desktop/moblie/ionic/Myapp/platforms/android/src/com/danielcwilson/plugins/analytics/UniversalAnalyticsPlugin.java:193: error: package HitBuilders does not exist
.ExceptionBuilder()
^
/Users/Mac/Desktop/moblie/ionic/Myapp/platforms/android/src/com/danielcwilson/plugins/analytics/UniversalAnalyticsPlugin.java:214: error: package HitBuilders does not exist
.TimingBuilder()
^
/Users/Mac/Desktop/moblie/ionic/Myapp/platforms/android/src/com/danielcwilson/plugins/analytics/UniversalAnalyticsPlugin.java:237: error: package HitBuilders does not exist
.TransactionBuilder()
^
/Users/Mac/Desktop/moblie/ionic/Myapp/platforms/android/src/com/danielcwilson/plugins/analytics/UniversalAnalyticsPlugin.java:262: error: package HitBuilders does not exist
.ItemBuilder()
^
/Users/Mac/Desktop/moblie/ionic/Myapp/platforms/android/src/com/danielcwilson/plugins/analytics/UniversalAnalyticsPlugin.java:279: error: cannot find symbol
GoogleAnalytics.getInstance(this.cordova.getActivity()).getLogger().setLogLevel(LogLevel.VERBOSE);
^
symbol: variable LogLevel
location: class UniversalAnalyticsPlugin
/Users/Mac/Desktop/moblie/ionic/Myapp/platforms/android/src/com/danielcwilson/plugins/analytics/UniversalAnalyticsPlugin.java:279: error: cannot find symbol
GoogleAnalytics.getInstance(this.cordova.getActivity()).getLogger().setLogLevel(LogLevel.VERBOSE);
^
symbol: variable GoogleAnalytics
location: class UniversalAnalyticsPlugin
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
17 errors
FAILED


#2

In SDK download manager install all packages under Extras.


#3

Can you explain how to do it. I was a rookie for the ionic :smile:


#4

It’s not related to Ionic at all, it’s related to Android SDK, read the docs.


#5

I do not understand this description

## Update Instructions

1. Install the .jar via the Android SDK Manager (`android sdk`)
2. Copy it from `android-sdk/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar`
3. Update the version number in `plugin.xml` to match `Pkg.Revision` from `android-sdk/extras/google/google_play_services/source.properties`
4. Copy in the new `version.xml` from `android-sdk/extras/google/google_play_services/libproject/google-play-services_lib/res/values`
5. Run `plugman publish .` to publish to registry

#6

https://developer.android.com/sdk/installing/adding-packages.html


#7

I have not cleared.
this step

  1. Install the .jar ----> (what is .jar?)
  2. copy google-play-services.jar And I have to put it where?
  3. I not see “Pkg.Revision” in source.properties

#8

You don’t have to know what is a jar, it’s just a java package.
You don’t have to know where to put it, the SDK downloader does it for you under ANDROID_HOME

This is basic Android stuff.

Those instructions you copied are just manual stuff that is handled by the UI tool.