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!