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

查看所有标签

猜你喜欢:

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

精通Windows应用开发

精通Windows应用开发

[美] Jesse Liberty Philip Japikse Jon Galloway / 苏宝龙 / 人民邮电出版社 / 59.00元

Windows 8.1的出现不仅提供了跨设备的用户体验,也提供了跨设备的开发体验。本书着眼于实际项目中所需要的特性,以及现有C#编程知识的运用,对如何最大限度地利用Metro、WinRT和Windows 8进行了讲解,内容详尽,注重理论学习与实践开发的配合。 Windows 8.1和WinRT的作用及其特殊性 如何使用先进特性创建具有沉浸感和吸引力的Windows 8.1应用 如......一起来看看 《精通Windows应用开发》 这本书的介绍吧!

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

在线压缩/解压 CSS 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

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

HSV CMYK互换工具