[android-developers] Re: Google analytics crash
I hit the same exception. From reading about SQLite it appears to be creating separate database connections from two different threads can lead to this. I'm not sure if that's the case, but from the previous poster talking about posting the events at a later time I could see that might be. While catching the exception at least prevents the app from crashing, it means that some small percentage of events may go unreported which is not all that great either. Unfortunately I think the fix probably has to be done within the Google Analystics sdk itself. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Google analytics crash
I did the same, wrap all analytics calls in a try/catch block, Mark On Mon, Jan 3, 2011 at 3:39 AM, blindfold wrote: > Well, after another user apparently had 6 crashes in 2 minutes from > GoogleAnalyticsTracker.trackEvent() right when launching my app, I've > updated my app to wrap all Google Analytics calls in try-catch blocks > to quench the symptoms. Even though the crash reports were rare, this > seems to be the only/simplest way for me to avoid an occasional bad > user experience due to use of Google Analytics. > > Regards > > > java.lang.RuntimeException: Unable to start activity > ComponentInfo{vOICe.vOICe/vOICe.vOICe.The_vOICe}: > java.lang.IllegalStateException: no transaction pending at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java: > 2663) at > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: > 2679) at android.app.ActivityThread.access$2300(ActivityThread.java: > 125) at android.app.ActivityThread$H.handleMessage(ActivityThread.java: > 2033) at android.os.Handler.dispatchMessage(Handler.java:99) at > android.os.Looper.loop(Looper.java:123) at > android.app.ActivityThread.main(ActivityThread.java:4627) at > java.lang.reflect.Method.invokeNative(Native Method) at > java.lang.reflect.Method.invoke(Method.java:521) at > com.android.internal.os.ZygoteInit > $MethodAndArgsCaller.run(ZygoteInit.java:878) at > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636) at > dalvik.system.NativeStart.main(Native Method) Caused by: > java.lang.IllegalStateException: no transaction pending at > android.database.sqlite.SQLiteDatabase.endTransaction(SQLiteDatabase.java: > 555) at > com.google.android.apps.analytics.PersistentEventStore.putEvent(Unknown > Source) at > com.google.android.apps.analytics.GoogleAnalyticsTracker.createEvent(Unknown > Source) at > com.google.android.apps.analytics.GoogleAnalyticsTracker.trackEvent(Unknown > Source) at vOICe.vOICe.The_vOICe.a(Unknown Source) at > vOICe.vOICe.The_vOICe.onCreate(Unknown Source) at > android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: > 1047) at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java: > 2627) ... 11 more > > FINGERPRINT {verizon/thunderc/thunderc/thunderc:2.2/FRF91/eng.lge. > 20101101.102025:user/release-keys} > > > On Dec 31 2010, 3:55 pm, blindfold wrote: >> Hmm, I have only one global tracker object that I create in the >> onCreate() of my main activity, and with a regular dispatch interval >> through the format tracker.start("UA-12345-0", nseconds, this), so I'd >> say that it all works from one alive thread. However, in one pair of >> crash logs the first GoogleAnalyticsTracker.trackEvent() crash occurs >> after my app had been running for some time, while the second >> GoogleAnalyticsTracker.trackEvent() crash occurs immediately at app >> startup only 3 minutes later, for the same device FINGERPRINT, >> suggesting that indeed some sort of lock had lived on even across runs >> to cause a second crash because the second run would not be owning the >> lingering lock. This was for a Samsung GT-I5800 running Android 2.1- >> update1. >> >> On Dec 31, 3:21 pm, H wrote: >> >> > Looking in the analytics source after you've called trackEvent(), I suspect >> > that error is coming out when it is using a database transaction to insert >> > the event into the database. Once inserted, it calls endTransaction as well >> > as setTransactionSuccessful. Both of these do this check: >> >> > if (!mLock.isHeldByCurrentThread()) { >> > throw new IllegalStateException("no transaction pending"); >> > } >> >> > So it could be worth checking to see if you are tracking the event from a >> > thread that has ended, or calling dispatch from a different thread...? >> >> > HTH. > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Google analytics crash
Well, after another user apparently had 6 crashes in 2 minutes from GoogleAnalyticsTracker.trackEvent() right when launching my app, I've updated my app to wrap all Google Analytics calls in try-catch blocks to quench the symptoms. Even though the crash reports were rare, this seems to be the only/simplest way for me to avoid an occasional bad user experience due to use of Google Analytics. Regards java.lang.RuntimeException: Unable to start activity ComponentInfo{vOICe.vOICe/vOICe.vOICe.The_vOICe}: java.lang.IllegalStateException: no transaction pending at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2663) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2679) at android.app.ActivityThread.access$2300(ActivityThread.java: 125) at android.app.ActivityThread$H.handleMessage(ActivityThread.java: 2033) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4627) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:878) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.IllegalStateException: no transaction pending at android.database.sqlite.SQLiteDatabase.endTransaction(SQLiteDatabase.java: 555) at com.google.android.apps.analytics.PersistentEventStore.putEvent(Unknown Source) at com.google.android.apps.analytics.GoogleAnalyticsTracker.createEvent(Unknown Source) at com.google.android.apps.analytics.GoogleAnalyticsTracker.trackEvent(Unknown Source) at vOICe.vOICe.The_vOICe.a(Unknown Source) at vOICe.vOICe.The_vOICe.onCreate(Unknown Source) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1047) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2627) ... 11 more FINGERPRINT {verizon/thunderc/thunderc/thunderc:2.2/FRF91/eng.lge. 20101101.102025:user/release-keys} On Dec 31 2010, 3:55 pm, blindfold wrote: > Hmm, I have only one global tracker object that I create in the > onCreate() of my main activity, and with a regular dispatch interval > through the format tracker.start("UA-12345-0", nseconds, this), so I'd > say that it all works from one alive thread. However, in one pair of > crash logs the first GoogleAnalyticsTracker.trackEvent() crash occurs > after my app had been running for some time, while the second > GoogleAnalyticsTracker.trackEvent() crash occurs immediately at app > startup only 3 minutes later, for the same device FINGERPRINT, > suggesting that indeed some sort of lock had lived on even across runs > to cause a second crash because the second run would not be owning the > lingering lock. This was for a Samsung GT-I5800 running Android 2.1- > update1. > > On Dec 31, 3:21 pm, H wrote: > > > Looking in the analytics source after you've called trackEvent(), I suspect > > that error is coming out when it is using a database transaction to insert > > the event into the database. Once inserted, it calls endTransaction as well > > as setTransactionSuccessful. Both of these do this check: > > > if (!mLock.isHeldByCurrentThread()) { > > throw new IllegalStateException("no transaction pending"); > > } > > > So it could be worth checking to see if you are tracking the event from a > > thread that has ended, or calling dispatch from a different thread...? > > > HTH. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Google analytics crash
Hmm, I have only one global tracker object that I create in the onCreate() of my main activity, and with a regular dispatch interval through the format tracker.start("UA-12345-0", nseconds, this), so I'd say that it all works from one alive thread. However, in one pair of crash logs the first GoogleAnalyticsTracker.trackEvent() crash occurs after my app had been running for some time, while the second GoogleAnalyticsTracker.trackEvent() crash occurs immediately at app startup only 3 minutes later, for the same device FINGERPRINT, suggesting that indeed some sort of lock had lived on even across runs to cause a second crash because the second run would not be owning the lingering lock. This was for a Samsung GT-I5800 running Android 2.1- update1. On Dec 31, 3:21 pm, H wrote: > Looking in the analytics source after you've called trackEvent(), I suspect > that error is coming out when it is using a database transaction to insert > the event into the database. Once inserted, it calls endTransaction as well > as setTransactionSuccessful. Both of these do this check: > > if (!mLock.isHeldByCurrentThread()) { > throw new IllegalStateException("no transaction pending"); > } > > So it could be worth checking to see if you are tracking the event from a > thread that has ended, or calling dispatch from a different thread...? > > HTH. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Google analytics crash
Looking in the analytics source after you've called trackEvent(), I suspect that error is coming out when it is using a database transaction to insert the event into the database. Once inserted, it calls endTransaction as well as setTransactionSuccessful. Both of these do this check: if (!mLock.isHeldByCurrentThread()) { throw new IllegalStateException("no transaction pending"); } So it could be worth checking to see if you are tracking the event from a thread that has ended, or calling dispatch from a different thread...? HTH. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Google analytics crash
You may be right, although the crash reports that I have all suggest that they were triggered from direct calls to GoogleAnalyticsTracker.trackEvent() in my code leading to "java.lang.IllegalStateException: no transaction pending". Judiciously sprinkling try-catch blocks is a great way to further "uglify" source code, so maybe I'll just live with the occasional crashes until Google fixes the problem, given that thus far only 3 out of 5000 app runs gave me crashes. Thanks On Dec 31, 2:26 pm, H wrote: > You could stick a try/catch block in, but I doubt it would catch *most* of > the bugs. Remember that your request for a track simply gets added to the > database at that point and then some time later the dispatcher picks > requests up from the database and sends them (although if you ask it to > dispatch immediately you might catch them, but due to the use of handlers, I > still doubt it). So your try/catch in your code would only catch errors from > the first part and not the second. > > From the ACRA reporting in my app for the previous release of the analytics, > the vast majority of my errors were coming from the latter part of the > process where it was trying to read back from the database or failed during > the sending part or failed when removing entries from the database. > > The analytics team did state they fixed a load of bugs in this latest > release. I don't know if it's against the rules or not, but I decompiled the > latest release and built it natively into my app and that allowed me to > stick in a sprinkling of my own try/catch clauses around spots that I > thought looked tetchy. I haven't released this yet.. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Google analytics crash
You could stick a try/catch block in, but I doubt it would catch *most* of the bugs. Remember that your request for a track simply gets added to the database at that point and then some time later the dispatcher picks requests up from the database and sends them (although if you ask it to dispatch immediately you might catch them, but due to the use of handlers, I still doubt it). So your try/catch in your code would only catch errors from the first part and not the second. >From the ACRA reporting in my app for the previous release of the analytics, the vast majority of my errors were coming from the latter part of the process where it was trying to read back from the database or failed during the sending part or failed when removing entries from the database. The analytics team did state they fixed a load of bugs in this latest release. I don't know if it's against the rules or not, but I decompiled the latest release and built it natively into my app and that allowed me to stick in a sprinkling of my own try/catch clauses around spots that I thought looked tetchy. I haven't released this yet.. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Google analytics crash
> anyone else getting this? I have recently received several crash reports caused by Google Analytics (version 1.1), such as java.lang.IllegalStateException: no transaction pending at android.database.sqlite.SQLiteDatabase.endTransaction(SQLiteDatabase.java: 480) at com.google.android.apps.analytics.PersistentEventStore.putEvent(Unknown Source) at com.google.android.apps.analytics.GoogleAnalyticsTracker.createEvent(Unknown Source) at com.google.android.apps.analytics.GoogleAnalyticsTracker.trackEvent(Unknown Source) at vOICe.vOICe.The_vOICe.a(Unknown Source) at vOICe.vOICe.m.onAutoFocus(Unknown Source) at android.hardware.Camera $EventHandler.handleMessage(Camera.java:345) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4363) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:862) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620) at dalvik.system.NativeStart.main(Native Method) I'm not sure yet what to do about them. Maybe put a try-catch block around all uses of Google Analytics? Regards On Dec 29, 8:39 pm, Mark Wyszomierski wrote: > Hi, > > I'm using google analytics in my app. I am getting a good number of > force closes from users, finally got a stacktrace: > > Caused by: android.database.sqlite.SQLiteException: file is encrypted > or is not a database > at android.database.sqlite.SQLiteDatabase.native_setLocale(Native > Method) > at > android.database.sqlite.SQLiteDatabase.setLocale(SQLiteDatabase.java: > 1864) > at android.database.sqlite.SQLiteDatabase.(SQLiteDatabase.java: > 1814) > at > android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java: > 808) > at > android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java: > 168) > at > com.google.android.apps.analytics.PersistentEventStore.getNumStoredEvents(PersistentEventStore.java: > 160) > at > com.google.android.apps.analytics.PersistentEventStore.startNewVisit(PersistentEventStore.java: > 177) > at > com.google.android.apps.analytics.GoogleAnalyticsTracker.start(GoogleAnalyticsTracker.java: > 108) > at > com.google.android.apps.analytics.GoogleAnalyticsTracker.start(GoogleAnalyticsTracker.java: > 99) > at > com.google.android.apps.analytics.GoogleAnalyticsTracker.start(GoogleAnalyticsTracker.java: > 83) > at > com.google.android.apps.analytics.GoogleAnalyticsTracker.start(GoogleAnalyticsTracker.java: > 94) > at com.me.myapp.MyActivity.onCreate(MyActivity.java:30) > at > android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: > 1047) > at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java: > 2459) > > anyone else getting this? The call that causes it: > > private GoogleAnalyticsTracker tracker; > > tracker = GoogleAnalyticsTracker.getInstance(); > tracker.start("mykey", context); <- causes the exception. > > This is working fine for most users. I'm going to try catching the > exception, hopefully that will work. > > Thanks -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Google analytics crash
A question - what version of the analytics sdk are you using..? There was a new flavour released recently which said it fixed many of the bugs... -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en