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)
Joshua Wunder
  • 237
  • 1
  • 6
  • 15
  • Android has changed how you access your storage files. You have to override the settings Use this in the Application Class. See this thread :https://stackoverflow.com/questions/38200282/android-os-fileuriexposedexception-file-storage-emulated-0-test-txt-exposed – Sarthak Gandhi Jul 09 '17 at 10:26
  • I don't think I'm accessing any files in my code. I know it looks that way in the exception, but the file accessing is happening internally in android code, not in my code... am I misunderstanding something? – Joshua Wunder Jul 10 '17 at 09:18

1 Answers1

0

It might be due to a lack of permission.

Have you obtained storage permissions?

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

Depending on the Android SDK that you are targeting, you might need to request the permission at runtime.

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

licitdev
  • 319
  • 2
  • 9