原 荐 React-native 文件选择器react-native-file-selector的使用

栏目: 服务器 · 发布时间: 6年前

最后是错误解决办法,本文只说明安装方法,具体使用查看 https://github.com/prscX/react-native-file-selector

1 、npm install react-native-file-selector --save

2 、最好不要自动 link     --react-native link react-native-file-selector

手动link步骤

A 、在android\settings.gradle添加

include ':react-native-file-selector'

project(':react-native-file-selector').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-file-selector/android')

B、在android\build.gradle添加

maven { url "http://dl.bintray.com/lukaville/maven" }

原 荐 React-native 文件选择器react-native-file-selector的使用

C 、在android\app\build.gradle中添加

implementation project(':react-native-file-selector')

原 荐 React-native 文件选择器react-native-file-selector的使用

D 、在MainApplication.java中引用jar包

import ui.fileselector.RNFileSelectorPackage;

在getPackages()中使用

new RNFileSelectorPackage(),

原 荐 React-native 文件选择器react-native-file-selector的使用

3、添加选择文件主题颜色,可以自定义

增加文件android/app/src/main/res/values/colors.xml

原 荐 React-native 文件选择器react-native-file-selector的使用

4、添加权限 android\app\src\main\AndroidManifest.xml

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

记一下的原因是安装依赖,自动link后出现各种报错,和之前引用的依赖冲突,或者打包报错

Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.

> java.io.IOException: Can't write [D:\Work\drp_admin_app\android\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\Users\Admin\.gradle\caches\transforms-1\files-1.1\support-core-ui-27.1.0.aar\b6c4178a4c08c4dfa3ddaf1b25f9d379\jars\classes.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]))

我的解决办法

在android/app/build.gradle中加入

原 荐 React-native 文件选择器react-native-file-selector的使用

原 荐 React-native 文件选择器react-native-file-selector的使用

还有一些其他的我尝试了没有用,也记一下

原 荐 React-native 文件选择器react-native-file-selector的使用

或者是 implementation  'com.android.support:multidex:1.0.3'

这些都是老的sdk版本


以上所述就是小编给大家介绍的《原 荐 React-native 文件选择器react-native-file-selector的使用》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

自媒体之道

自媒体之道

吴晨光 / 中国人民大学出版社有限公司 / 2018-7-31 / CNY 49.80

内容简介: 《自媒体之道》为你解决四个问题: 1. 一篇10万+的刷屏文章是怎么写出来的? 2. 一支10万+的爆款视频是怎么做出来的? 3. 一个100万+粉丝的大号是怎么运营的? 4. 神秘的人工智能(AI)和备受争议的算法是怎么运行的? 这部超过30万字的著作,集纳了中国顶尖自媒体人和平台运营者3年的实操经验。全书13章,详解案例150+,提炼“锦囊秒句”......一起来看看 《自媒体之道》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

html转js在线工具
html转js在线工具

html转js在线工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具