Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Analytics V2 SDK for Android EasyTracker giving errors

I have followed the tutorial for the new Google Analytics V2 SDK for Android located here:

https://developers.google.com/analytics/devguides/collection/android/v2/

Unfortunately whenever I go to run the application the reporting is not working and this is the messages that logcat gives me:

07-09 09:13:16.978: W/Ads(13933): No Google Analytics: Library Incompatible.
07-09 09:13:16.994: I/Ads(13933): To get test ads on this device, call adRequest.addTestDevice("2BB916E1BD6BE6407582A429D763EC71");
07-09 09:13:17.018: I/Ads(13933): adRequestUrlHtml: <html><head><script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_getSdkConstants();AFMA_buildAdURL({"kw":[],"preqs":0,"session_id":"7925570029955749351","u_sd":2,"seq_num":"1","slotname":"a14fd91432961bd","u_w":360,"msid":"com.mysampleapp.sampleapp","js":"afma-sdk-a-v6.0.1","mv":"8013013.com.android.vending","isu":"2BB916E1BD6BE6407582A429D763EC71","cipa":1,"format":"320x50_mb","net":"wi","app_name":"1.android.com.mysampleapp.sampleapp","hl":"en","u_h":592,"carrier":"311480","ptime":0,"u_audio":3});</script></head><body></body></html>
07-09 09:13:17.041: W/ActivityManager(220): Unable to start service Intent { act=com.google.android.gms.analytics.service.START (has extras) }: not found
07-09 09:13:17.049: W/GAV2(13933): Thread[main,5,main]: Connection to service failed 1
07-09 09:13:17.057: W/GAV2(13933): Thread[main,5,main]: Need to call initializea() and be in fallback mode to start dispatch.
07-09 09:13:17.088: D/libEGL(13933): loaded /system/lib/egl/libGLES_android.so
07-09 09:13:17.096: D/libEGL(13933): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
07-09 09:13:17.096: D/libEGL(13933): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
07-09 09:13:17.096: D/libEGL(13933): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so

Here is my code (I have redacted some of the code that had to do with httppost, etc.):

    package com.mysampleapp.sampleapp;

    import java.io.BufferedReader;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.util.ArrayList;
    import java.util.List;

    import org.apache.http.HttpEntity;
    import org.apache.http.HttpResponse;
    import org.apache.http.NameValuePair;
    import org.apache.http.client.HttpClient;
    import org.apache.http.client.entity.UrlEncodedFormEntity;
    import org.apache.http.client.methods.HttpPost;
    import org.apache.http.impl.client.DefaultHttpClient;
    import org.apache.http.message.BasicNameValuePair;
    import org.json.JSONArray;
    import org.json.JSONObject;

    import com.google.analytics.tracking.android.EasyTracker;

    import android.app.Activity;
    import android.app.ProgressDialog;
    import android.content.DialogInterface;
    import android.content.DialogInterface.OnCancelListener;
    import android.content.Intent;
    import android.content.SharedPreferences;
    import android.os.AsyncTask;
    import android.os.Bundle;
    import android.preference.PreferenceManager;
    import android.util.Log;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.ImageView;
    import android.widget.TextView;


    public class viewRandom extends Activity {

        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            setContentView(R.layout.viewrandom);



            uservote.setVisibility(View.GONE);
            new randomViewClass().execute();

        }

        public void onStart() {
            super.onStart();
            EasyTracker.getInstance().activityStart(this);
        }

        public void onStop() {
            super.onStop();
            EasyTracker.getInstance().activityStop(this);
        }
}
like image 979
Jeff Thomas Avatar asked Jul 09 '12 16:07

Jeff Thomas


People also ask

How do I see errors in Google Analytics?

Look for 404 Page SessionsGo to the All Pages report (Behavior > Pages > All Pages) and search for “404” to see how many times people hit an error page in the timeframe you're viewing. To further analyze how these visits to error pages occurred, you can segment by source using the Secondary Dimension dropdown.

Can Google Analytics track errors?

Checking Error Data in Google Analytics Now, it's time to check your error data in Google Analytics. If you were tracking them as events, you will find them in Behavior > Events > Top Events report.


2 Answers

I realize this is an old post, but I wanted to provide some more information sense this is exactly the same error I was receiving today.

Prince is exactly correct, it's from the dashes. For most deleting the dash and typing out - again will work. But once you clean your project again it will switch it back to the en_dash which might be mysho's problem.

It does this automatically because of Android Lint. You can disable it though!

Go into your preferences (I'm on a mac so for me it's Eclipse -> Preferences)

Go to Android Go to Lint error Checking

You can either disable Lint checker completely or do what I did, disable just the en_dash thing

Either fine the one called "TypographyDashes" under Usability:Typography or search "dash" inside the search box. Either way it should come up with TypographyDashes.

Highlight it and turn it to "Ignore" under the severity

From there Click apply and then allow it to relint

Hope I could help

like image 180
Travis Avatar answered Oct 31 '22 19:10

Travis


OK I found out what the problem was with this. It was within my analytics.xml file:

<?xml version="1.0" encoding="utf-8" ?>
<resources>
    <string name="ga_trackingId">UA-0000000-00</string>
    <bool name="ga_autoActivityTracking">true</bool>
    <bool name="ga_reportUncaughtExceptions">true</bool>
    <string name="ga_sampleFrequency">20</string>
</resources>

What had happened was when I pasted my trackingId into the file, eclipse had converted it to an "en dash" automatically and Google was unable to read my trackingId properly. Changing the en dashes to regular dashes worked fine and now everything in functioning.

like image 4
Jeff Thomas Avatar answered Oct 31 '22 19:10

Jeff Thomas