我的问题是这样的,我试图理解这个跟踪的来源:
11-06 22:07:36.593 2744-3492/com.spot.spottester W/f: Suppressed StrictMode policy violation: StrictModeDiskReadViolation
11-06 22:07:36.594 2744-2744/com.spot.spottester W/f: Suppressed StrictMode policy violation: StrictModeDiskReadViolation
我得到了这些StrictMode线出现在我的Android Studio logcat每次我旋转屏幕从纵向到横向,反之亦然。我不明白为什么logcat表示"抑制",因为我认为StrictMode在我的主要活动(唯一一个)中被激活
@Override
protected void onCreate(Bundle savedInstanceState) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build());
附加信息:当我使用地图时,我看到这种严格的模式违规,地图片段在framayout
<FrameLayout
android:id="@+id/mapContainer"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_gravity="center_horizontal"
android:layout_weight="0.35">
<fragment
android:id="@+id/mapFragment"
class="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</FrameLayout>
logcat的附加行
11-07 08:47:39.495 32751-4156/com.spot.spottester I/dalvikvm-heap: Grow heap (frag case) to 15.568MB for 196624-byte allocation
11-07 08:47:40.217 32751-32751/com.spot.spottester I/Google Maps Android API: Google Play services package version: 9877036
谢谢大家!
更新:现在修复为Google Play Services 10.2.0:
https://code.google.com/p/gmaps-api-issues/issues/detail?id=11077好消息!问题,你看到"抑制StrictMode政策违规:StrictModeDiskReadViolation"日志现在在谷歌播放服务10.2修复。修复安装在用户设备上的Google Play Services APK。
原文:我在logcat中也看到了这些"被抑制的StrictMode策略违反"的消息-使用谷歌地图片段。即使我没有在我的应用程序中使用StrictMode,抑制消息仍然出现。
我认为这可能与谷歌在10月份修复的这个问题有关,因为我最近才注意到它:
https://code.google.com/p/gmaps-api-issues/issues/detail?id=10170这个问题现在在Google Play Services 9.8版本中修复了。你应该不再看到StrictMode违规从Android地图API因此,您应该能够重新启用StrictMode
我的想法是他们通过将它们写为单个"抑制"行来"固定"大堆栈跟踪输出…但是他们也在非严格模式应用程序中加入了它