I faced with the next problem:
StrictMode policy violation; ~duration=2235 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=65567 violation=2
at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1278)
at libcore.io.BlockGuardOs.lseek(BlockGuardOs.java:162)
at java.io.RandomAccessFile.seek(RandomAccessFile.java:603)
at java.util.zip.Zip64.parseZip64EocdRecordLocator(Zip64.java:98)
at java.util.zip.ZipFile.readCentralDir(ZipFile.java:419)
at java.util.zip.ZipFile.<init>(ZipFile.java:175)
at java.util.zip.ZipFile.<init>(ZipFile.java:131)
at dalvik.system.DexPathList$Element.maybeInit(DexPathList.java:452)
at dalvik.system.DexPathList$Element.findResource(DexPathList.java:499)
at dalvik.system.DexPathList.findResource(DexPathList.java:360)
at dalvik.system.BaseDexClassLoader.findResource(BaseDexClassLoader.java:67)
at java.lang.ClassLoader.getResource(ClassLoader.java:403)
at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:442)
at ch.qos.logback.classic.util.ContextInitializer.getResource(Unknown Source)
at ch.qos.logback.classic.util.ContextInitializer.findConfigFileURLFromAssets(Unknown Source)
at ch.qos.logback.classic.util.ContextInitializer.autoConfig(Unknown Source)
at org.slf4j.impl.StaticLoggerBinder.init(Unknown Source)
at org.slf4j.impl.StaticLoggerBinder.<clinit>(Unknown Source)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:412)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
at com.my.utils.x.c(LogUtils.java:164)
at com.my.utils.x.b(LogUtils.java:65)
at com.my.Application.onCreate(Application.java:148)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1018)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4970)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1560)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5765)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
I got this error in 3 places:
1) logger = LoggerFactory.getLogger(name);
2) mMessagesJobManager = new JobManager(this, configuration);
3) Fabric.with(this, new Crashlytics());
I didn't find any info about these methods in documentation. I found only one solution - use AsyncTask, but should I fix it? If yes, why documentation doesn't contain any info about it? Best regards.
I didn't find any info about these methods in documentation
That is because none of them are part of Android. Presumably, they are from libraries that you added to your app (slf4j, Fabric, and I'm guessing perhaps Firebase).
I found only one solution - use AsyncTask, but should I fix it?
Well, your app is crashing. If you want to ship this app, you need to do something to stop crashing.
In your code, you configured StrictMode
to apply penaltyDeath()
for disk reads. Hence, your choices are:
Move this disk I/O off the main application thread, which is the best solution in general, though it may prove impractical (given that you do not control the implementation of the libraries)
Stop configuring StrictMode
to apply penaltyDeath()
for disk reads.
If yes, why documentation doesn't contain any info about it?
There is documentation on StrictMode
, if that is what you mean. Beyond that, I imagine that Google expects professional app developers to read books, take courses, or find other ways to learn about Android app development beyond what is covered directly in the documentation.