Hi, I have a problem with Google Analytics plugin. I have integrated it with my game and in my GA dashboard I have some informations gained by plugin, so generally it works, but when I play my game and I press device back button and then i want to launch app again there is an error and my app is stopped… In my google analytics under behavior->crashes and exceptions section I see an error “IllegalStateException (@CoronaGoogleAnalytics:init:46) {main}”. Does anybody else have the same situation, can you help me?
Can you provide some error report/output details from Corona, when the crash occurs?
Thanks,
Brent
I don’t have configured LogCat with my phone right now, but this is part of LogCat from my BlueStacks simulator
[lua]
D/BstCommandProcessor-Application( 5882): data: {“packageName”:“com.gmail.gruszowski.kamil.circle_run”,“shortPackageName”:“com.gmail.gruszowski.kamil.circle_run”,“versionCode”:1,“versionName”:“1.0.0”}
D/AndroidRuntime( 7457): procName from cmdline: com.gmail.gruszowski.kamil.circle_run
E/AndroidRuntime( 7457): in writeCrashedAppName, pkgName :com.gmail.gruszowski.kamil.circle_run
D/AndroidRuntime( 7457): file written successfully with content: com.gmail.gruszowski.kamil.circle_run StringBuffer : ;com.gmail.gruszowski.kamil.circle_run
E/AndroidRuntime( 7457): FATAL EXCEPTION: main
E/AndroidRuntime( 7457): Process: com.gmail.gruszowski.kamil.circle_run, PID: 7457
E/AndroidRuntime( 7457): java.lang.IllegalStateException: ERROR: googleAnalytics Extra call to init analytics trackers
E/AndroidRuntime( 7457): at plugin.googleAnalytics.CoronaGoogleAnalytics.init(CoronaGoogleAnalytics.java:46)
E/AndroidRuntime( 7457): at plugin.googleAnalytics.LuaLoader$1.run(LuaLoader.java:93)
E/AndroidRuntime( 7457): at android.os.Handler.handleCallback(Handler.java:733)
E/AndroidRuntime( 7457): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime( 7457): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 7457): at android.app.ActivityThread.main(ActivityThread.java:5021)
E/AndroidRuntime( 7457): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 7457): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 7457): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
E/AndroidRuntime( 7457): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
E/AndroidRuntime( 7457): at dalvik.system.NativeStart.main(Native Method)
W/InputDispatcher( 5704): channel ‘2e99e880 com.gmail.gruszowski.kamil.circle_run/com.ansca.corona.CoronaActivity (server)’ ~ Consumer closed input channel or an error occurred. events=0x9
E/InputDispatcher( 5704): channel ‘2e99e880 com.gmail.gruszowski.kamil.circle_run/com.ansca.corona.CoronaActivity (server)’ ~ Channel is unrecoverably broken and will be disposed!
I/ActivityManager( 5704): Process com.gmail.gruszowski.kamil.circle_run (pid 7457) has died.
W/ActivityManager( 5704): Force removing ActivityRecord{2e9665a4 u0 com.gmail.gruszowski.kamil.circle_run/com.ansca.corona.CoronaActivity t5}: app died, no saved state
W/InputDispatcher( 5704): Attempted to unregister already unregistered input channel ‘2e99e880 com.gmail.gruszowski.kamil.circle_run/com.ansca.corona.CoronaActivity (server)’
D/GuidanceScreen( 5901): event === app_launch
D/GuidanceScreen( 5901): hiding guidance
D/GuidanceScreen( 5901): hardKeyboard = 1
D/GuidanceScreen( 5901): controllerType === Keyboard
D/GuidanceScreen( 5901): appName: Gamepop-Home, currentPkg: com.bluestacks.gamepophome, event: app_launch, controller: Keyboard
D/GuidanceScreen( 5901): appName: Gamepop-Home
I/WindowState( 5704): WIN DEATH: Window{2e9e0d04 u0 SurfaceView}
I/WindowState( 5704): WIN DEATH: Window{2e99e880 u0 com.gmail.gruszowski.kamil.circle_run/com.ansca.corona.CoronaActivity}
[/lua]
The problem is “E/AndroidRuntime( 7457): java.lang.IllegalStateException: ERROR: googleAnalytics Extra call to init analytics trackers” but how to avoid this extra call?
Hi All,
I have also been facing the same error (IllegalStateException (@CoronaGoogleAnalytics:init:46) {main}) in 2 different apps of mine. As these are two different apps and other people are facing the same exact problem …Could this be a problem with the Google analytic plugin or some other plugin itself?
Best regards,
George
Hey Kamil,
I know what I am going to propose is not the best solution, in fact it is the worst solution.
You could try to mask the problem by using an exception handler to handle unhanded errors till problem is fixed. This should at least help from preventing your whole app from crashing at the client end.
I am currently using it and did not see any crashes in beta testing of my games, not sure at the client end. However, this problem still does appear at my Google analytic page.
Do try (at your own risk ) and let us know.
Best regards,
George
local function myUnhandledErrorListener( event ) local iHandledTheError = true if iHandledTheError then print( "Handling the unhandled error", event.errorMessage ) else print( "Not handling the unhandled error", event.errorMessage ) end return iHandledTheError end Runtime:addEventListener("unhandledError", myUnhandledErrorListener)
Hi all,
I just asked the engineers to investigate this…
Brent
Thank you Brent, please notify us, when something will change
i Have the same issue, do you have any solution? my only option now is to remove Google plugin.
Hi,
are there some news about that error? I must admit that it’s a little bit important for me.
Best regards,
Kamil
Hi all,
Are you calling init() more than once? This seems to be a potential cause of the error. We’ll look into fixing that, but for now, you should ensure that you’re not calling init() twice.
Brent
I call it only once, but the problem appears when the game goes to the back ground and i run it again.
Hi Brent,
I aslo init() the plugin only once in main.lua, you can check it in code below (of course I’ve replaced my original plugin ID with myId text):
[lua]
– FILE: main.lua
– DESCRIPTION: start the app, declare some variables, and setup the player save file
– CONSTANT VALUES
_CX = display.contentWidth*0.5;
_CY = display.contentHeight*0.5;
_CW = display.contentWidth;
_CH = display.contentHeight;
_T = display.screenOriginY; – TOP
_L = display.screenOriginX; – LEFT
_R = display.viewableContentWidth - _L – RIGHT
_B = display.viewableContentHeight - _T; – BOTTOM
if(display.pixelHeight/display.pixelWidth < 1.67) then
_RATIO = 1.66;
_FULLSCREEN_HEIGHT = 800;
else
_RATIO = 1.77;
_FULLSCREEN_HEIGHT = 853;
end
– hide the status bar
display.setStatusBar(display.HiddenStatusBar);
– include composer
local composer = require(‘composer’);
– include load/save library from coronarob
loadsave = require(“libs.loadsave”)
– Admob
adService = require(‘libs.adservice’);
adService.initAdmob(‘myId’, true);
– Vungle
adService.initVungle(‘myId’);
– Google Analytics
ga = require(‘plugin.googleAnalytics’)
ga.init( “Bonus”, “myId” )
local function hideNativeBar(event)
native.setProperty( “androidSystemUiVisibility”, “immersiveSticky” )
end
– load user data object
local user = loadsave.loadTable(“user.json”)
if(user == nil) then
user = {}
user.stars = 99
user.maxLevel = 0
user.lastAd = 0
user.playsound = true
user.powers = {
slomo = 0,
rhino = 0,
flash = 0
}
loadsave.saveTable(user, “user.json”)
end
Runtime:addEventListener( “resize”, hideNativeBar)
native.setProperty( “androidSystemUiVisibility”, “immersiveSticky” )
composer.gotoScene(‘scenes.characters’);
[/lua]
This is a critical bug that forces all apps that have the new Google Analytics plugin to disable the android back key or not use Google Analytics plugin.
Both are unrealistic choices. Since the Google Analytics plugin was released recently, can we get Corona to give this a high priority and fix it immediately?
If things are going to break like this without any solution, it defeats all the ease of use that corona provides.
Longtime Corona Developer but getting fed up with unresolved critical bugs that don’t get fixed
OK, we should have a fix coming for this within the next few days. I’ll pressure engineering to get it into place. Apologies for the delay.
Brent
Hi guys,
We updated this plugin a short time ago. Can you please re-build and test to confirm if this is fixed?
Best regards,
Brent
Thanks Brent.
Which daily build should I use to test this fix? I am not seeing it any daily build notes.
Hi @vweb20,
It’s not tied to a build number. You should be able to just re-build and the latest plugin version will be downloaded and built along with.
Brent
Thanks for the fix. I just rebuilt again which got updated plugin and now back button is working while google analytics is enabled.
Great to hear! Thanks for your prompt testing, and we appreciate your patience on this matter.
Brent