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

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

最后是错误解决办法,本文只说明安装方法,具体使用查看 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的使用》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

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

深入Linux内核架构

深入Linux内核架构

Wolfgang Mauerer / 郭旭 / 人民邮电出版社 / 201005 / 149.00元

众所周知,Linux操作系统的源代码复杂、文档少,对程序员的要求高,要想看懂这些代码并不是一件容易事。本书结合内核版本2.6.24源代码中最关键的部分,深入讨论Linux内核的概念、结构和实现。具体包括进程管理和调度、虚拟内存、进程间通信、设备驱动程序、虚拟文件系统、网络、时间管理、数据同步等方面的内容。本书引导你阅读内核源代码,熟悉Linux所有的内在工作机理,充分展现Linux系统的魅力。 ......一起来看看 《深入Linux内核架构》 这本书的介绍吧!

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具