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.

targetSdk 29 (scoped storage) support?

See original GitHub issue

Description

Fresco failed to load images from EXTERNAL_CONTENT_URI e.g. content://media/external/images/media/8039, FileNotFoundException was seen from the logs

Reproduction

Loading images with EXTERNAL_CONTENT_URI content://media/external/images/media/8039

Solution

I found that inside com.facebook.imagepipeline.producers.LocalContentUriFetchProducer, given the above content uri, it will fall to the call getCameraImage and which in turn getting the absolute file path of the image. However, due to scoped storage in targetSdk 29, that wouldn’t be allowed. Probably getting input stream like

ParcelFileDescriptor pfd = mContentResolver.openFileDescriptor(contentUri, "r");
FileInputStream fis = FileInputStream(pfd.getFileDescriptor());

Additional Information

  • Fresco version: 2.0.0
  • Platform version: Android 10

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
paulmasterscommented, Aug 10, 2020

@esafirm I’ve made this PR to show where I got to, if you could test that it works for you that would be great

1reaction
husseinrasticommented, Feb 19, 2020
<manifest >
  <application 
        android:requestLegacyExternalStorage="true"
        tools:targetApi="q">
  </application>
</manifest>

use this solution as a temporary one

Read more comments on GitHub >

github_iconTop Results From Across the Web

Behavior changes: apps targeting API 29+ - Android Developers
Scoped storage ; Access to USB device serial number; Ability to enable, disable, and configure Wi-Fi; Location permissions for connectivity APIs. These changes, ......
Read more >
Scoped storage / Android 11, targetSdkVersion = 30 / save ...
Is there any way to save → non-media files to /Documents or /Download on targetSdk=30 (without MANAGE_EXTERNAL_STORAGE permission )?.
Read more >
Android 10 Behavioral Changes
Apps that run on targetSDK version 29 and later are given scoped access to external storage (or scoped storage), by default. These apps...
Read more >
New features and enhancements summary
Support for scoped storage: The Generation 2 wrapper supports scoped storage. ... If the targetSdkVersion of the app is 29 and the app...
Read more >
Scope Storage Myths. No, you don't have to use SAF | - Medium
Android 11 is out, more and more devices are being updated. As is tradition, apps will be required to update their targetSdkVersion to...
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