原 荐 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的使用》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

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

Pro JavaScript Techniques

Pro JavaScript Techniques

John Resig / Apress / 2006-12-13 / USD 44.99

Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web s......一起来看看 《Pro JavaScript Techniques》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

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

html转js在线工具