0

I get the following exception when running on the new Samsung Galaxy 8 phones. The exception doesn't give me any information about what's causing it (as far as I can tell). I don't have an S8 phone to try to pinpoint the line of offending code.

Does anybody have any idea what the problem is or how to figure it out?

TIA

java.lang.SecurityException: 
at android.app.ContextImpl.checkMode(ContextImpl.java:2323)
at android.app.ContextImpl.openFileOutput(ContextImpl.java:534)
at android.content.ContextWrapper.openFileOutput(ContextWrapper.java:192)
at com.yandex.metrica.impl.o.c(SourceFile:178)
at com.yandex.metrica.impl.o.a(SourceFile:44)
at com.yandex.metrica.impl.o$a.a(SourceFile:310)
at com.yandex.metrica.impl.o.b(SourceFile:164)
at com.yandex.metrica.impl.bh.c(SourceFile:139)
at com.yandex.metrica.impl.ag.c(SourceFile:145)
at com.yandex.metrica.impl.ag$a.run(SourceFile:295)
at com.yandex.metrica.impl.ob.bh.execute(SourceFile:10)
at com.yandex.metrica.impl.ob.bj.execute(SourceFile:7)
at com.yandex.metrica.impl.ag.run(SourceFile:86)
4

1 回答 1

0

可能是因为没有权限。

您是否获得了存储权限?

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

根据您所针对的 Android SDK,您可能需要在运行时请求权限。

https://developer.android.com/training/basics/data-storage/files.html

于 2017-07-09T09:59:23.220 回答