Error found when using World Construction Kit ( WCK ) and Google Analytics

I am a big fan of the Box2D World Construction Kit and have used it to many build several games. However when working with the packages recently I encountered a strange problem when trying to incorporate Google Analytics into the build. I have used Google Analytics many times in the past, so I was surprised to find an error when using it. I had opted to use the Analytics component and avoid using the AnalyticsLibrary component. I spent a while trying to figure out if there was a problem in my code, but there really is not much you can get wrong with Google Analytics and this was not the case. Here is the error I was receiving:

outer-scope = [global Object$ flash.events::EventDispatcher$ flash.display::DisplayObject$ flash.display::InteractiveObject$ flash.display::DisplayObjectContainer$ flash.display::Sprite$ flash.display::MovieClip$ Preload$]
[Preload~[O] *[A]] {} ()
0:getlocal0
[Preload~[O] *[A]] {} (Preload~[O])
1:pushscope
[Preload~[O] *[A]] {Preload~[O]} ()
2:findpropstrict com.google.analytics::GATracker
[Preload~[O] *[A]] {Preload~[O]} (Object~[A])
4:getlocal0
[Preload~[O] *[A]] {Preload~[O]} (Object~[A] Preload~[O])
5:pushstring “UA-19243777-5”
[Preload~[O] *[A]] {Preload~[O]} (Object~[A] Preload~[O] String~[S])
7:pushstring “AS3”
[Preload~[O] *[A]] {Preload~[O]} (Object~[A] Preload~[O] String~[S] String~[S])
9:constructprop 11 3
[Preload~[O] *[A]] {Preload~[O]} (*[A])
12:coerce com.google.analytics::AnalyticsTracker

VerifyError: Error #1014: Class com.google.analytics::AnalyticsTracker could not be found.

at Preload/handleComplete()

To this day I am unsure why the class can not be found when trying to use Google Analytics with Box2D World Construction Kit. It is really strange, I can trace everything as expected but it still errors. The workaround we came up with was to install the Google AnalyticsLibrary component into Flash. For some reason this solved my issue, and I was able to compile after doing this even though I didn’t adjust any of my code.

If anyone could unravel this further then leave a comment! I am intrigued to find out the real reason behind this. For the mean time, if anyone else encounters this bug then placing the LibraryComponent into the library may help you.

Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditShare on StumbleUponShare on TumblrEmail this to someone

Leave a Reply

Your email address will not be published.