问题
I'm using Google Analytics SDK v4 for Android to record the exceptions. I followed the sample app but I could see no exceptions getting registered in the dashboard.
I wrote the code as below
/*exception tracking */
// Get tracker.
Tracker t2 =
((MyApp) this.getApplication()).getTracker(TrackerName.APP_TRACKER);
// Build and send exception.
int a = 0;
String exceptionStr = "";
try{
int b = a/0;
}catch(Exception ex){
exceptionStr = ex.toString();
}finally{
t2.send(new HitBuilders.ExceptionBuilder()
.setDescription(exceptionStr + ":" + "In Main screen")
.setFatal(true)
.build());
GoogleAnalytics.getInstance(this.getApplicationContext()).dispatchLocalHits();
Log.v("Manual logging", "finished for analytics");
}
"Manual logging", "finished for analytics"
is showing up in the logcat window but when I check the analytics there is nothing registered.
BTW the user screen flow etc working just fine with the SDK. Just the exception logging is not working.
回答1:
Data can take some time to show up in the GoogleAnalytics dashboard. Give it some time, it will show up under exceptions.
回答2:
This works for me but I'm using advanced crash report implementation.
Go to Behavior --> Crashes & Exceptions
In the top right drop-down (below date range selector), select "Faster Response, less Precision" option instead of the default "Slower Response, Greater Precision":
Also, additionally, you can click on the "Refresh Report" button in the lower right corner if the last reported generated is stale:
If none of the above work, then wait for 24 hours for GA to generate the reports :)
来源:https://stackoverflow.com/questions/23753079/android-google-analytics-exception-logging