【问题标题】:StrictMode policy violation: StrictModeDiskReadViolation,WriteViolation in AndroidStrictMode 策略违规:Android 中的 StrictModeDiskReadViolation、WriteViolation
【发布时间】:2016-12-13 03:31:47
【问题描述】:

我正在开发一个使用 Google 地图的 Android 项目。该应用程序在我的手机上运行良好,有 5.1.1 Android 版本,因为我用它来开发项目,但同一个应用程序在其他手机(6.0.0 Android)上无法运行。在其他手机谷歌地图没有更新。 (不去当前位置)。为什么其他手机不更新谷歌地图?

提示这个;

12-13 08:25:55.796 11170-11170/com.example.mapspractice1 W/f: Suppressed StrictMode policy violation: StrictModeDiskReadViolation

12-13 08:25:55.796 11170-11170/com.example.mapspractice1 W/f: Suppressed StrictMode policy violation: StrictModeDiskWriteViolation

12-13 08:25:55.939 11170-11458/com.example.mapspractice1 W/DynamiteModule: Local module descriptor class for com.google.android.gms.googlecertificates not found.

12-13 08:25:55.949 11170-11458/com.example.mapspractice1 I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:2

12-13 08:25:55.949 11170-11458/com.example.mapspractice1 I/DynamiteModule: Selected remote version of com.google.android.gms.googlecertificates, version >= 2

12-13 08:25:59.044 11170-11209/com.example.mapspractice1 V/FA: Inactivity, disconnecting from the service

【问题讨论】:

  • 为什么票数接近?这个问题显然是关于编程的。

标签: android google-maps android-maps-v2 android-strictmode


【解决方案1】:

我认为您看到的日志警告与问题无关,它们只是警告,我相信您可以放心地忽略它们。

可能与无法在Android M (6) 中获取当前位置有关的是新的Runtime Permissions 模型。 如果您将android:targetSdkVersion 设置为23 或更高级别,则除了将其置于AndroidManifest 之外,您还需要明确要求用户提供所需的每个权限。

要检查这一点,在Android M 设备上,

打开手机的“设置”应用 > 应用 > 查找并选择您的应用 > 权限 > 启用“位置”权限。

它现在应该可以正确识别应用中的位置了。

看到这个:https://developer.android.com/training/permissions/requesting.html 关于如何在运行时向用户请求权限。

【讨论】:

  • 谢谢谢谢你告诉我原因。我通过if (ActivityCompat.checkSelfPermission(getApplicationContext(),......... 方法解决了这个问题。没有人回答。 40 次观看后,您来了。再次非常感谢。我有简单的话;愿上帝赐你。 :) 现在它工作正常。
  • 很高兴它有帮助。您应该将答案标记为已接受以将问题标记为已解决,并帮助保持 StackOverflow 干净
猜你喜欢
  • 2021-07-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-25
  • 2019-09-10
  • 1970-01-01
相关资源
最近更新 更多