gpt4 book ai didi

android - 严格模式 + 分析

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:24:05 28 4
gpt4 key购买 nike

我正在使用适用于 Android 的 Google Analytics,但在启用 StrictMode 后,我收到了很多这样的消息:

 StrictMode policy violation; ~duration=349 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=23 violation=2
at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:745)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1345)
at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1235)
at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1189)
at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1309)
at com.google.android.apps.analytics.PersistentEventStore.peekEvents(Unknown Source)
at com.google.android.apps.analytics.PersistentEventStore.peekEvents(Unknown Source)
at com.google.android.apps.analytics.GoogleAnalyticsTracker.dispatch(Unknown Source)
at com.google.android.apps.analytics.GoogleAnalyticsTracker$1.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3647)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)

我可以忽略它吗?我还尝试将 tracker.trackingPageView(...) 放入 AsyncTask - 相同的结果。

这是我对 StrictMode 的设置:

    StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork()
.penaltyLog()
.build());

StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectLeakedSqlLiteObjects()
.penaltyLog()
.penaltyDeath()
.build());

我非常感谢任何帮助 - 提前致谢!迈克

最佳答案

查看 iosched他们的应用程序 AnalyticsUtils.java它围绕跟踪调用做了一些异步任务魔术。但是在构造函数中有这个:

    // Unfortunately this needs to be synchronous.
mTracker.start(UACODE, 300, mApplicationContext);

关于android - 严格模式 + 分析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6289280/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com