• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Android Google Analytics Extension

C

comatsu

Guest
I've opened the demo provided with GM:S to see how Google Analytics works, and this code compiles and works fine.

However when I download (from the marketplace) the extension into my game I get the following error when trying to compile:

Code:
...

:com.companyname.AA:compileReleaseJavaWithJavacD:\GMcache\AA\Android\Default\com.companyname.AA\src\main\java\com\companyname\AA\GoogleAnalyticsExt.java:14: error: package com.google.android.gms.analytics does not exist
import com.google.android.gms.analytics.GoogleAnalytics;
                                       ^
D:\GMcache\AA\Android\Default\com.companyname.AA\src\main\java\com\companyname\AA\GoogleAnalyticsExt.java:15: error: package com.google.android.gms.analytics does not exist
import com.google.android.gms.analytics.Tracker;
                                       ^
D:\GMcache\AA\Android\Default\com.companyname.AA\src\main\java\com\companyname\AA\GoogleAnalyticsExt.java:16: error: package com.google.android.gms.analytics does not exist
import com.google.android.gms.analytics.HitBuilders;
                                       ^
D:\GMcache\AA\Android\Default\com.companyname.AA\src\main\java\com\companyname\AA\GoogleAnalyticsExt.java:17: error: package com.google.android.gms.analytics.Logger does not exist
import com.google.android.gms.analytics.Logger.*;
^
D:\GMcache\AA\Android\Default\com.companyname.AA\src\main\java\com\companyname\AA\GoogleAnalyticsExt.java:21: error: cannot find symbol
    private Tracker mTracker;
            ^
  symbol:   class Tracker
  location: class GoogleAnalyticsExt
D:\GMcache\AA\Android\Default\com.companyname.AA\src\main\java\com\companyname\AA\GoogleAnalyticsExt.java:25: error: cannot find symbol
        GoogleAnalytics ga = GoogleAnalytics.getInstance(RunnerActivity.CurrentActivity);
        ^
  symbol:   class GoogleAnalytics
  location: class GoogleAnalyticsExt
D:\GMcache\AA\Android\Default\com.companyname.AA\src\main\java\com\companyname\AA\GoogleAnalyticsExt.java:25: error: cannot find symbol
        GoogleAnalytics ga = GoogleAnalytics.getInstance(RunnerActivity.CurrentActivity);
                             ^
  symbol:   variable GoogleAnalytics
  location: class GoogleAnalyticsExt
D:\GMcache\AA\Android\Default\com.companyname.AA\src\main\java\com\companyname\AA\GoogleAnalyticsExt.java:28: error: cannot find symbol
        ga.getLogger().setLogLevel(LogLevel.VERBOSE);
                                   ^
  symbol:   variable LogLevel
  location: class GoogleAnalyticsExt
D:\GMcache\AA\Android\Default\com.companyname.AA\src\main\java\com\companyname\AA\GoogleAnalyticsExt.java:45: error: package HitBuilders does not exist
            mTracker.send(new HitBuilders.AppViewBuilder().build());
                                         ^
D:\GMcache\AA\Android\Default\com.companyname.AA\src\main\java\com\companyname\AA\GoogleAnalyticsExt.java:55: error: package HitBuilders does not exist
            mTracker.send( new HitBuilders.EventBuilder()
                                          ^
D:\GMcache\AA\Android\Default\com.companyname.AA\src\main\java\com\companyname\AA\GoogleAnalyticsExt.java:68: error: package HitBuilders does not exist
            mTracker.send( new HitBuilders.EventBuilder()
                                          ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: D:\GMcache\AA\Android\Default\com.companyname.AA\src\main\java\com\companyname\AA\Gamepad\Gamepad.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
11 errors
FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':com.companyname.AA:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 7.185 secs
FastCreate End End: 9:19:15 PM
Compile finished: 9:19:15 PM
I've tried to use the extension from the demo (in case this older version was working better), but I still get this error whenever I try to compile my game with it....
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Have you made sure that the extension is set to export to Android on compile? Should be a setting in the extension package in GMS.
 
C

comatsu

Guest
OK just managed to get it to compile by adding this in the 'Inject to Gradle Dependencies' box -

Code:
compile 'com.google.android.gms:play-services:5.+'

Found this suggestion online and no idea what it is doing - but its working :)
 
OK just managed to get it to compile by adding this in the 'Inject to Gradle Dependencies' box -

Code:
compile 'com.google.android.gms:play-services:5.+'

Found this suggestion online and no idea what it is doing - but its working :)
Where is this box located?
 

DanMunchie

Member
Same error and tried the gradle inject as above but no luck. Throws a "multiple libraries found" error.

@comatsu - Just to confirm - did this happen to you after updating the Google Play Services extension to 2.5.0?
 
Last edited:

DanMunchie

Member
Solved with:
Code:
compile 'com.google.android.gms:play-services-analytics:9.6.1'
added to the box described above. Using just "5+" caused a conflict and Build Fail for me. Hope this helps someone.
 
Top