安装插件

npm install react-native-camera --save

react-native link react-native-camera

遇到的问题

java.lang.RuntimeException: Android dependency 'androidx.slidingpanelayout:slidingpanelayout' has different version

for the compile (1.0.0-rc01) and runtime (1.0.0) classpath.You should manually set the same version via DependencyResolution

解决方法:

(1)android/gradle.properties加入

android.enableJetifier=true

android.useAndroidX=true

(2)android/app/build.gradle /defaultConfig加上

multiDexEnabled true

(3)android/build.gradle更改依赖

classpath 'com.android.tools.build:gradle:3.3.1'

(4)android/gradle/wrapper/gradle-wrapper.properties文件修改

distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐