react-native-file-opener icon indicating copy to clipboard operation
react-native-file-opener copied to clipboard

[Android] Crashed if targetSdkVersion >= 24 on Android N devices

Open LionelWei opened this issue 7 years ago • 5 comments

如果targetSdkVersion >= 24, 在Android N设备上使用file://打开文件会崩溃. 应使用content://替代.

refer to: http://stackoverflow.com/questions/38200282/android-os-fileuriexposedexception-file-storage-emulated-0-test-txt-exposed

LionelWei avatar Mar 30 '17 08:03 LionelWei

+1

alanstos avatar Nov 20 '18 14:11 alanstos

I am using SDK Version 27. The problem is that version 0.2 of this React Native plugin does not include the changes as specified by the FileProvider API. What I did was to change my package.json file to download the Git repository instead:

"react-native-file-opener": "git://github.com/huangzuizui/react-native-file-opener.git"

Furthermore I downloaded all files to an external paths which is why I needed to change my files_path.xml file to this:

<paths xmlns:android="http://schemas.android.com/apk/res/android">
  <external-files-path name="pdf" path="pdf/"/>
</paths>

Hope that helps!

sebastiangrebe avatar Feb 20 '19 09:02 sebastiangrebe

所以请问 js里面能改吗?

Tosiwe avatar Mar 15 '19 14:03 Tosiwe

@LionelWei 请问。怎么改? 我不懂安卓啊。

GuoJiKaiHehe avatar Apr 03 '19 10:04 GuoJiKaiHehe

我试了,切换到23 可以打开。

GuoJiKaiHehe avatar Apr 03 '19 10:04 GuoJiKaiHehe