22

New to Android development and trying out StrictMode on my app for the first time. I noticed the following and would like to know if this is a problem in my app or a library—it’s not readily clear to me.

Thank you!

D/StrictMode: StrictMode policy violation: android.os.strictmode.LeakedClosableViolation: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. Callsite: readFromParcel
    at android.os.StrictMode$AndroidCloseGuardReporter.report(StrictMode.java:1929)
    at dalvik.system.CloseGuard.warnIfOpen(CloseGuard.java:305)
    at android.view.SurfaceControl.finalize(SurfaceControl.java:1104)
    at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:291)
    at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:278)
    at java.lang.Daemons$Daemon.run(Daemons.java:139)
    at java.lang.Thread.run(Thread.java:923)
Bink
  • 1,934
  • 1
  • 25
  • 41
  • 4
    Have you resolved this? I've run into the same problem (devices with API 30 seem to be affected the most) – Alex Shevchyshen Dec 10 '20 at 20:30
  • 1
    @AlexShevchyshen Not yet. For right now I’ve only tried StrictMode on the latest API and have not done all the other APIs my app supports. – Bink Dec 11 '20 at 15:55
  • 2
    I found this issue, looks like only API30 devices are affected, probably something has to do with the layout inspector https://issuetracker.google.com/issues/167533582 – Alex Shevchyshen Dec 12 '20 at 14:04
  • @AlexShevchyshen Nice sleuthing. Although, Google says this is fixed in AS 4.2 Canary 12, but that doesn’t appear to be the case. – Bink Dec 14 '20 at 15:24
  • 1
    yeah, but the comment right above mine on issue tracker says that it is not actually fixed in canary 12 (I cannot confirm because I'm either using stable or Beta build) – Alex Shevchyshen Dec 14 '20 at 18:58
  • it's may be from any inspector (database or layout) , but when I disconnect the device from android studio it works fine – Sherif farid Jun 30 '21 at 10:40
  • 2
    I'm seeing this on an API 31 device. There is no "attached stack trace" so it's hard to know where to look. – dugsmith Mar 04 '22 at 21:07

0 Answers0