(1) app/build.gradle
android { compileSdkVersion 25 buildToolsVersion "25.0.2" } compile (project(‘:react-native-camera‘)) { exclude group: "com.android.support", module: ‘support-v4‘ }
(2) build.grande
buildscript { repositories { jcenter() google() } dependencies { classpath ‘com.android.tools.build:gradle:3.0.1‘ } } allprojects { repositories { mavenLocal() jcenter() google() maven { url "$rootDir/../node_modules/react-native/android" } maven { url "https://jitpack.io" } maven { url "https://maven.google.com" } google() } }
(3) gradle/wrapper/gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
经过以上三步,解决了我的问题。
如果打包时出现图片检测错误 aapt
在gradle/wrapper/gradle-wrapper.properties 关闭aapt检测
android.useDeprecatedNdk=true + android.enableAapt2=false MYAPP_RELEASE_STORE_FILE=my-release-key.keystore MYAPP_RELEASE_KEY_ALIAS=my-key-alias MYAPP_RELEASE_STORE_PASSWORD=yangzonglong MYAPP_RELEASE_KEY_PASSWORD=yangzonglong