AbdFatah / analytics-issues

Automatically exported from code.google.com/p/analytics-issues
0 stars 0 forks source link

Analytics for Android: NullPointerException in NetworkDispatcher.stop() #139

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Name of affected component: Mobile Tracking

Name of related library, if applicable (e.g. Android, iOS, Snippets, etc.):
libGoogleAnalytics.jar (version 1.2 from official site)

Issue summary:
I'm running a batch of my tests which all use analytics tracking lib, so I 
guess this puts a lot of calls to it while testing. From time to time (every 
3rd test run roughly) it crashes inside an analytics lib with a trace provided 
below.

I'm not able to specify the exact steps to reproduce - this exception doesn't 
arise in ordinary usage patterns.

Steps to reproduce issue:
1. Have some test which tests some code which starts analytics with 
GoogleAnalyticsTracker.getInstance().start()
2. Run this test many times :)
3. Crash! (I wish it would be Profit! ;-))

Expected output:
No output. Lib should deal with this strange situation somehow - as my code is 
quite innocent :) It simply starts tracker in Service.onCreate() and then puts 
several trackPage/trackEvent requests while working.

Actual results:
java.lang.NullPointerException. See the backtrace below.

StackTrace:

java.lang.NullPointerException
at com.google.android.apps.analytics.NetworkDispatcher.stop(Unknown Source)
at com.google.android.apps.analytics.NetworkDispatcher.init(Unknown Source)
at com.google.android.apps.analytics.GoogleAnalyticsTracker.start(Unknown 
Source)
at com.google.android.apps.analytics.GoogleAnalyticsTracker.start(Unknown 
Source)
at com.google.android.apps.analytics.GoogleAnalyticsTracker.start(Unknown 
Source)
at com.google.android.apps.analytics.GoogleAnalyticsTracker.start(Unknown 
Source)
at com.the7art.clockwallpaperlib.ClockWallpaper.onCreate(ClockWallpaper.java:24)
at android.test.ServiceTestCase.startService(ServiceTestCase.java:189)
at 
com.the7art.flowerparadewallpaper.test.FlowerParadeWallpaperServiceTest.setUp(Fl
owerParadeWallpaperServiceTest.java:42)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at 
android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:52
9)
at 
android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1448)

Original issue reported on code.google.com by dim...@gmail.com on 1 Aug 2011 at 12:14

GoogleCodeExporter commented 9 years ago
Is it possible you're calling the GoogleAnalyticsTracker from different threads 
(perhaps multiple tests being run on different threads)?

Original comment by nrho...@google.com on 1 Nov 2011 at 6:19

GoogleCodeExporter commented 9 years ago
Also, can you try this with the latest (1.3.1) SDK?

Original comment by nrho...@google.com on 1 Nov 2011 at 7:08

GoogleCodeExporter commented 9 years ago

Original comment by awa...@google.com on 7 Nov 2013 at 9:33