我们升级了Google Play服务到:
compile 'com.google.android.gms:play-services-base:7.5.0'
compile 'com.google.android.gms:play-services-analytics:7.5.0'
请注意,文档指出我们需要使用play-services-analytics:7.3.0版本,但由于我们正在使用play services 7.5,因此我们已经使用了开始时列出的配置。应用程序编译正常,但我们注意到我们的Google Analytics不再发送到我们的服务器。每次调用Tracker.send()时,以下行将在错误日志中出现每个事件:
06-30 10:51:43.188 13623-13752/com.fairfax.domain E/SQLiteLog﹕ (1032) statement aborts at 31: [INSERT OR REPLACE INTO properties(cid,app_uid,hits_count,adid,params,tid) VALUES (?,?,?,?,?,?)]
06-30 10:51:43.198 13623-13752/com.fairfax.domain E/GAv4﹕ Error storing a property: android.database.sqlite.SQLiteReadOnlyDatabaseException: attempt to write a readonly database (code 1032)
06-30 10:51:44.348 13623-13752/com.fairfax.domain E/SQLiteLog﹕ (1032) statement aborts at 31: [INSERT OR REPLACE INTO properties(cid,app_uid,hits_count,adid,params,tid) VALUES (?,?,?,?,?,?)]
06-30 10:51:44.358 13623-13752/com.fairfax.domain E/GAv4﹕ Error storing a property: android.database.sqlite.SQLiteReadOnlyDatabaseException: attempt to write a readonly database (code 1032)
06-3
我们代理了流量并发现它似乎没有发送GA事件。
作为临时解决方案,我们进行了手动分派更改:
analytics.setLocalDispatchPeriod(0);
并手动调用:
GoogleAnalytics.getInstance(appContext).dispatchLocalHits();
当然,这并不是最理想的情况,我们应该如何让Google Analytics根据配置处理存储/发送而不出现错误?
更新:值得一提的是,我们正在从play services 6.5升级。
更新2:我们再次代理了网络,现在GA似乎会在一段时间后发送/batch请求。尽管如此,那些SQLite错误仍然存在:
8273-8329/com.fairfax.domain E/SQLiteLog﹕ (1032) statement aborts at 29: [INSERT OR REPLACE INTO properties(cid,app_uid,hits_count,adid,params,tid) VALUES (?,?,?,?,?,?)]