I've enabled StrictMode
on my app by code:
public void onCreate() {
setStrictMode();
super.onCreate();
}
private void setStrictMode() {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.penaltyDeath()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectAll()
.penaltyLog()
.build());
}
I found a crash when startup with log below :
StrictMode policy violation; ~duration=0 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=95 violation=2 at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1137) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:182) at libcore.io.IoBridge.open(IoBridge.java:442) at java.io.FileInputStream.(FileInputStream.java:76) at android.graphics.Typeface.getFullFlipFont(Typeface.java:582) at android.graphics.Typeface.getFontPathFlipFont(Typeface.java:530) at android.graphics.Typeface.SetFlipFonts(Typeface.java:717) at android.graphics.Typeface.SetAppTypeFace(Typeface.java:844) at android.app.Application.onCreate(Application.java:108)
I think is an io operate on main thread violation, My device is samsung s6, android version 5.1.1, but I can't find the method getFullFlipFont
anywhere, if I disable strictmode it will be alright, where is the io violation happen?