Pankaj
Pankaj

Reputation: 8058

Issue with Google Analytics on production app

I have integrated the Google Analytics successfully and working fine. Uploaded the app on google play store also but now I am getting crashes on daily basis the crash which I am getting on app is as follows:

0   java.lang.RuntimeException: Unable to instantiate service com.google.android.gms.analytics.AnalyticsService: java.lang.ClassNotFoundException: com.google.android.gms.analytics.AnalyticsService
1   at android.app.ActivityThread.handleCreateService(ActivityThread.java:2425)
2   at android.app.ActivityThread.access$1600(ActivityThread.java:145)
3   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
4   at android.os.Handler.dispatchMessage(Handler.java:119)
5   at android.os.Looper.loop(Looper.java:137)
6   at android.app.ActivityThread.main(ActivityThread.java:4873)
7   at java.lang.reflect.Method.invokeNative(Native Method)
8   at java.lang.reflect.Method.invoke(Method.java:528)
9   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
10  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11  at dalvik.system.NativeStart.main(Native Method)
12  Caused by: java.lang.ClassNotFoundException: com.google.android.gms.analytics.AnalyticsService
13  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:72)
14  at java.lang.ClassLoader.loadClass(ClassLoader.java:524)
15  at java.lang.ClassLoader._logged_loadClass(ClassLoader.java:484)
16  at java.lang.ClassLoader.loadClass(ClassLoader.java:476)
17  at android.app.ActivityThread.handleCreateService(ActivityThread.java:2422)
18  ... 10 more
19  java.lang.ClassNotFoundException: com.google.android.gms.analytics.AnalyticsService
20  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:72)
21  at java.lang.ClassLoader.loadClass(ClassLoader.java:524)
22  at java.lang.ClassLoader._logged_loadClass(ClassLoader.java:484)
23  at java.lang.ClassLoader.loadClass(ClassLoader.java:476)
24  at android.app.ActivityThread.handleCreateService(ActivityThread.java:2422)
25  at android.app.ActivityThread.access$1600(ActivityThread.java:145)
26  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
27  at android.os.Handler.dispatchMessage(Handler.java:119)
28  at android.os.Looper.loop(Looper.java:137)
29  at android.app.ActivityThread.main(ActivityThread.java:4873)
30  at java.lang.reflect.Method.invokeNative(Native Method)
31  at java.lang.reflect.Method.invoke(Method.java:528)
32  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
33  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
34  at dalvik.system.NativeStart.main(Native Method)

I was replicating the issue on my device but its not happening. Couldn't able to figure it out why its happening.

My guess is: this is happening because of Google play service but I'm not sure on that.

Haven't find any solution on SO and searched on google also. There was a same related issue which is mentioned on google code GA Issue page this is the link but I'm not getting NPE which is mentioned on that issue.

Upvotes: 1

Views: 213

Answers (1)

Kapil Rajput
Kapil Rajput

Reputation: 11545

This is the possible issue of device's having outdated Google play service installed, com.google.android.gms.analytics.AnalyticsService class is Introduced in and above version of google-play-service-sdk-4.0. so device's having old sdk's installed crashes so to handle these type of crashes you should keep a check of google-play-service are updated or not and if not inform user to updated device google-play-service.

int googleService_status= GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
if(googleService_status==ConnectionResult.SUCCESS){
 // code for Tracking
}else{
 GooglePlayServicesUtil.getErrorPendingIntent(googleService_status, context, 0).send();

 }

May it helps you.

Upvotes: 1

Related Questions