question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android 10/11 Scoped Storage

See original GitHub issue

The library should not use File, but always work with the Uri. Doing that, Glide is allowed to open the input stream via the Android Content Provider/MediaStore Uri and all is fine.

Scoped Storage is enabled in Android 10, as long as you don’t use android:requestLegacyExternalStorage="true" in your manifest. In Android 11 it will probably be the default, so your library won’t work anymore then.

Right now on Android 10, without the specified option, the following error is raised:

2020-01-18 17:58:20.005 7712-7774/com.levionsoftware.instagram_map E/SubsamplingScaleImageView: Failed to initialise bitmap decoder
    java.io.FileNotFoundException: /storage/emulated/0/DCIM/Camera/20191130_173206.jpg: open failed: EACCES (Permission denied)
        at libcore.io.IoBridge.open(IoBridge.java:496)
        at java.io.FileInputStream.<init>(FileInputStream.java:159)
        at java.io.FileInputStream.<init>(FileInputStream.java:115)
        at android.graphics.BitmapRegionDecoder.newInstance(BitmapRegionDecoder.java:151)
        at com.davemorrissey.labs.subscaleview.decoder.SkiaImageRegionDecoder.init(SkiaImageRegionDecoder.java:96)
        at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$TilesInitTask.doInBackground(SubsamplingScaleImageView.java:1559)
        at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$TilesInitTask.doInBackground(SubsamplingScaleImageView.java:1534)
        at android.os.AsyncTask$3.call(AsyncTask.java:378)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)
     Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
        at libcore.io.Linux.open(Native Method)
        at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
        at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
        at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
        at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7255)
        at libcore.io.IoBridge.open(IoBridge.java:482)
        at java.io.FileInputStream.<init>(FileInputStream.java:159) 
        at java.io.FileInputStream.<init>(FileInputStream.java:115) 
        at android.graphics.BitmapRegionDecoder.newInstance(BitmapRegionDecoder.java:151) 
        at com.davemorrissey.labs.subscaleview.decoder.SkiaImageRegionDecoder.init(SkiaImageRegionDecoder.java:96) 
        at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$TilesInitTask.doInBackground(SubsamplingScaleImageView.java:1559) 
        at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$TilesInitTask.doInBackground(SubsamplingScaleImageView.java:1534) 
        at android.os.AsyncTask$3.call(AsyncTask.java:378) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:919) 

Glide in combination with a default ImageView, or even com.github.chrisbanes.photoview.PhotoView however displayes my local images without errors by using the content Uri.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
DennyWeinbergcommented, May 23, 2020

hey, you should work on this!

0reactions
Piasycommented, May 24, 2020

I checked documents about scoped storage earlier, and I believe current implementation works fine, please provide more info if it doesn’t work in your case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Storage updates in Android 11 - Android Developers
Starting in Android 11, apps that use the scoped storage model can access only their own app-specific cache files. If your app needs...
Read more >
What is Scoped Storage in Android?
With Scoped Storage enforced, apps only can see their own data folders plus certain media types like music files using other storage APIs....
Read more >
Disabling "scoped storage" via ADB on Note 10+ updated to ...
Hello, I would like to know, for those who already received stock Android 11 on their Note 10/Note 10+, if the ability to...
Read more >
Scoped Storage with Enterprise Applications | Developer Portal
In Android 10, Google introduced Scoped Storage as a security enhancement, severely limiting an application's ability to access world ...
Read more >
scoped-storage · GitHub Topics
Simplify Android Storage Access Framework for file management across API levels. ... This app support Android 10, 11 and 12. So make use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found