NativeScript: Some real android device can not read a file from content uri

Issue Description

If we try to get a file using nativescript file API (File.fromPath(...)) and the path is a ContentUri, then on some real Android devices like Samsung Galaxy S20 or S21, we will get the following error:

TypeError: Cannot read property 'getName' of null
    at FileSystemAccess29.getFile (file:///data/data/net.fourpanels.MedicalApp/files/app/vendor.js:2:273622)
    at Function.fr...

I tried to debug and find the problem, and it looks like the error is in the native package of nativescript org.nativescript.widgets.FileHelper.fromString(...)

The file that causes the problem:‌ node_modules/@nativescript/core/file-system/file-system-access.android.js Screenshot 2023-02-01 at 20 44 25

Screenshot 2023-02-01 at 20 36 14

Reproduction

No response

Relevant log output (if applicable)

No response

Environment

No response

Please accept these terms

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 21 (11 by maintainers)

Most upvoted comments

Thanks for the support, already targeting the new google play store requirement for our next release seems like a good idea.

Thanks for info @jiswo we have a few PRs going up to address this week - may post back when another is up to try - assume you’re using Angular?

@NathanWalker, yes I’m using angular.