--------- beginning of crash
01-18 09:40:17.369 19238-19238/com.example.leakcanary E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.leakcanary, PID: 19238
android.os.StrictMode$StrictModeViolation: policy=327711 violation=2
at android.os.StrictMode.executeDeathPenalty(StrictMode.java:1556)
at android.os.StrictMode.-wrap3(StrictMode.java)
at android.os.StrictMode$AndroidBlockGuardPolicy.handleViolation(StrictMode.java:1549)
at android.os.StrictMode$AndroidBlockGuardPolicy$1.run(StrictMode.java:1427)
at android.os.Handler.handleCallback(Handler.java:755)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6524)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)
This happens to us too but we only turn on penalty death for our app. This makes it seem like Huawei lost their marbles and turned it on system-wide.
Should be an easy fix, just move data loading to background threads. PR welcome.
(fwiw, The sample enables strict mode, so Huawei is probably not crashing 90% of apps.)
Surprised that even works. I bet Huawei modified the ActivityThread code that starts an Application which by default disables all penalties. You need to post() any strict mode changes until after onCreate returns for them to apply, usually.
???
Remove the method-"enabledStrictMode()" can easily solve the problem,it works for me.
thanks
@AlexanderGH provided more insights in #845 :
These methods all perform some form of Disk I/O on the UI thread:
com.squareup.leakcanary.internal.DisplayLeakActivity$LeakListAdapter#getView (leak.resultFile.lastModified())
com.squareup.leakcanary.internal.DisplayLeakActivity#deleteAllLeaks (clearLeakDirectory)
com.squareup.leakcanary.internal.DisplayLeakActivity#onCreateOptionsMenu (heapDumpFile.exists())
com.squareup.leakcanary.internal.DisplayLeakActivity#shareHeapDump (setReadable)
Hi @hschenzhimin , Is this issue solved or Is help required for this?
Most helpful comment
Remove the method-"enabledStrictMode()" can easily solve the problem,it works for me.