Google Analytics causing crash on load (Android)

Hi guys, I’m trying to add Google Analytics. The app runs fine in the simulator (where it’s not actually using the plugin), and builds fine as well. However it crashes on startup when running on device. Any idea where things could be going wrong? The stack trace is as follows:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/analytics/GoogleAnalytics;

at plugin.googleAnalytics.CoronaGoogleAnalytics.get(CoronaGoogleAnalytics.java:95)

at plugin.googleAnalytics.CoronaGoogleAnalytics.init(CoronaGoogleAnalytics.java:47)

at plugin.googleAnalytics.LuaLoader$1.run(LuaLoader.java:93)

at android.os.Handler.handleCallback(Handler.java:739)

at android.os.Handler.dispatchMessage(Handler.java:95)

at android.os.Looper.loop(Looper.java:148)

at android.app.ActivityThread.main(ActivityThread.java:5422)

at java.lang.reflect.Method.invoke(Native Method)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Caused by: java.lang.ClassNotFoundException: Didn’t find class “com.google.android.gms.analytics.GoogleAnalytics” on path: DexPathList[[zip file “/data/app/com.applefork.bp-1/base.apk”],nativeLibraryDirectories=[/data/app/com.applefork.bp-1/lib/arm, /data/app/com.applefork.bp-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]

at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)

at java.lang.ClassLoader.loadClass(ClassLoader.java:511)

at java.lang.ClassLoader.loadClass(ClassLoader.java:469)

… 10 more

Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.analytics.GoogleAnalytics

at java.lang.Class.classForName(Native Method)

at java.lang.BootClassLoader.findClass(ClassLoader.java:781)

at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)

at java.lang.ClassLoader.loadClass(ClassLoader.java:504)

… 11 more

Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

 

And here’s my plugins table:

 

plugins =

{

   [“plugin.advertisingId”] =

        {

            publisherId = “com.coronalabs”

        },

        [“plugin.googleAnalytics”] =

        {

            publisherId = “com.coronalabs”,

            supportedPlatforms = { iphone=true, android=true }

        },

   [“plugin.flurry.analytics”] =

        {

            publisherId = “com.coronalabs”,

            supportedPlatforms = { iphone=true, android=true }

        },

        [“CoronaProvider.gameNetwork.google”] =

        {

            publisherId = “com.coronalabs”,

            supportedPlatforms = { android = true }

        },

        [“plugin.google.iap.v3”] =

        {

            publisherId = “com.coronalabs”,

            supportedPlatforms = { android=true }

        },

        [“plugin.GameThrivePushNotifications”] =

   {

       publisherId = “com.gamethrive”,

   },

   [“plugin.google.play.services”] =

   {

           publisherId = “com.coronalabs”,

           supportedPlatforms = { android=true, [“android-kindle”]=true },

   },

   [“plugin.facebook.v4”] =

        {

            publisherId = “com.coronalabs”

        },

        [“CoronaProvider.ads.vungle”] =

        {

            publisherId = “com.vungle”,

        },

        [“plugin.hockey”] =

        {

            publisherId = “com.coronalabs”,

            supportedPlatforms = { iphone=true, android=true }

        },

}

}

I’m using the plugin a very straightforward way. require(), init(), logEvent() – although I’m pretty certain the code never gets to logEvent(). 

Thanks!

There has been an issue with google analytics and other plugins. While I don’t know what plugins don’t work with google analytic, I believe it is the problem. I know corona was working on this, I don’t know if it was fixed. 

There is always the rest api, which works on all platform corona supports.

https://bitbucket.org/Jonjonsson/google-analytics-for-corona-sdk/

I also encountered with this issue, apart, when using admob plugin when the app enter suspend mode my app crashes. 

Thanks all. Looks like I’ll be pulling out the GA plugin for now. Will keep using Flurry and write my own lightweight stat server to make it easier to track the data I care about most.

Any update on this? I’m getting a similar issue and only using GA as my analytics solution for now. 

What other plugins are you using?

Rob

Rob, not sure if you were addressing me, but I pasted my plugin table in the original post. Let me know if you see any red flags. Would love to use GA. Thanks!

Google Analytics is not compatible with the AdMob V2 plugin:

   [“plugin.google.play.services”] =

   {

           publisherId = “com.coronalabs”,

           supportedPlatforms = { android=true, [“android-kindle”]=true },

   },

Unfortunately several other plugins have this as a dependency. Our engineers are trying to work through this. It’s a very difficult problem to solve.

Yup, using AdMob too. 

For the record - this is working fine on iOS, just crashes on Android as soon as the plugin is invoked.

I believe this is an Android conflict.

Hmm, I’m not using AdMob. And presumably it wouldn’t make sense for the Google Analytics plugin to conflict with the entire Google Play Services plugin, right?

plugin.google.play.services is currently the AdMob V2 plugin with a bunch of support libraries as well. It’s running an older version of GPS that’s not compatible with Google Analytics.  Many other ad providers need the libraries that are part of plugin.google.play.services. So if you have other ad plugins that could be causing the conflict as well.

Our engineering team is working to try and solve this. It’s a complex problem around library inter-dependencies.  For now, we suggest using another analytics provider like Flurry until we can solve this.

Rob

This is ridiculous,

Then is there a way to keep using GameAnalytics???

I was just replacing GameAnalytics with Google Analytics.  Flurry is just awful. This should not be a hard issue to solve, i would think it is critical.

Thanks (maybe)

 

Hi, Rob.
Have you found the solution of the problem?
I have the same problem with Google Analitycs and Appodeal plugin.
Unfortunately I can’t change Google Analytics to Flurry, because Appodeal works with Flurry also unstable.

Engineering is still working on it.

Rob

Hi Rob,

Any idea on the time for this? It is very important for our apps.

BTW i installed the Game Analytics  0.29 from GitHub, will there be a problem with that?

I would like to use Google Analytics instead.

Thanks

In case you didn’t see, Corona recently added support for TapJoy and Tenjin which both provide analytics capabilities and have free pricing tiers. I have not tried either, but they could be worth checking out as alternatives to Flurry and GA. 

If GameAnalytics works for you, use it. We announced last week in the blog that we are shortly going to change our plugins to a dependency system. Internally we’re testing that out now. We have quite a few plugins to update and test to make sure they are going to work fine. We ask for a little more patience while we work this out.

Yes, we do have Tenjin that has some analytics support. @aaronkarp, I’m unaware of TapJoy support where did you see that?

Rob

My bad I meant to say PlayFab, not TapJoy.

I am hitting this problem too. if I disable “plugin.google.play.services”, will google analytics work ? 

I am not using admob, but using applovin and vungle, and planning to use chart boost too. I am not sure if applovin,vungle and chartboost need “plugin.google.play.services” or not. Any one knows ?