Android-зависимость имеет другую версию после обновления React Native Navigation до V2
Я следовал странице Начало работы -> Установка, чтобы обновить мой проект React Native с Wix React Native Navigation V1 до V2. После этого мой проект Android больше не компилируется, выдав эту ошибку:
FAILURE: Build failed with an exception
- Что пошло не так: выполнение задачи не выполнено:app:preDebugBuild.
Зависимость Android 'com.android.support:recyclerview-v7' имеет разные версии для пути к классам компиляции (23.0.1) и времени выполнения (25.4.0). Вы должны вручную установить ту же версию через DependencyResolution
Это мой package.json:
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-eslint": "^8.0.3",
"babel-preset-flow": "^6.23.0",
"babel-preset-react-native-stage-0": "^1.0.1",
"eslint": "^4.13.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-flowtype": "^2.40.1",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.5.1",
"eslint-plugin-react-native": "^3.2.0",
"flow-bin": "^0.61.0",
"jest": "^21.2.1",
"react-test-renderer": "16.0.0",
"redux-devtools-extension": "^2.13.2"
},
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"test": "node node_modules/jest/bin/jest.js --watch"
},
"jest": {
"preset": "react-native"
},
"dependencies": {
"native-base": "^2.4.2",
"react": "16.2.0",
"react-native": "0.53.0",
"react-native-datepicker": "^1.6.0",
"react-native-easy-grid": "^0.1.17",
"react-native-elements": "^0.19.1",
"react-native-navigation": "^2.0.2267",
"react-native-vector-icons": "^4.6.0",
"react-redux": "^5.0.6",
"redux": "^3.7.2",
"redux-form": "^7.2.3",
"redux-logger": "^3.0.6",
"redux-saga": "^0.16.0",
"reselect": "^3.0.1"
}
Это мой android/app/build.gradle:
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 25
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.****"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':react-native-vector-icons')
implementation project(':react-native-vector-icons')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation ("com.android.support:appcompat-v7:25.4.0")
implementation "com.facebook.react:react-native:+" // From node_modules
implementation project(':react-native-navigation')
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
И все остальные файлы так же, как показано в руководстве по установке реагировать навигации