I have react native project which uses react-native@0.36.0. I am trying to upgrade the version to 0.40.0. In build.gradle there are these rows:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
}
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$projectDir/../../../node_modules/react-native/android"
}
}
dependencies {
compile 'com.facebook.react:react-native:+'
compile 'org.slf4j:slf4j-api:1.7.22'
}
When have updated the npm version of react-native all the "import com.facebook.react" became red. What am I missing?
Thanks.
UPDATE: I see that in /build/intermediates/exploded-aar there is version 0.36.0 despite the fact that in app.iml I have the rows:
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.react/react-native/0.40.0/jars" />
and
<orderEntry type="library" exported="" name="react-native-0.40.0" level="project" />
To upgrade from React Native 0.36.0 to 0.40.0, you will need to update the version of React Native in your build.gradle file. You can do this by changing this line:
compile 'com.facebook.react:react-native:+'
to this:
compile 'com.facebook.react:react-native:0.40.0'
You will also need to update your package.json file to use the new version of React Native. You can do this by changing this line:
"react-native": "0.36.0",
to this:
"react-native": "0.40.0",
Finally, you will need to update your code to use the new APIs introduced in React Native 0.40.0. There are several breaking changes that you will need to fix, such as the removal of the Navigator component and the addition of the createReactNativeComponentClass function. You can find more information about the changes in the React Native 0.40.0 release notes.