dependency error: react-native-linear-gradient
Closed this issue ยท 15 comments
"react": "16.0.0-alpha.12",
"react-native": "0.47.2",
Fix: react-native-linear-gradient/react-native-linear-gradient#202
What exactly is the error? What's not working properly?
node_modules/react-native-linear-gradient/android/src/main/java/com/BV/LinearGradient/LinearGradientPackage.java:20: error: method does not override or implement a method from a supertype
@Override
^
1 error
:react-native-linear-gradient:compileReleaseJavaWithJavac FAILED
Android build fails.
Setting the @shoutem/ui/package.json
react-native-linear-gradient
to ^2.0.0
instead of ~2.0.0
will resolve this. We're still working on full compatibility with React Native 0.47.2.
Alternatively you can also drop your React Native version down to one that's compatible with 2.0.x
react-native-linear-gradient
.
Hi Vladimir,
I changed "react-native-linear-gradient": "^2.0.0", but still get the error. What else should I do after making this change?
And if I downgrade React Native, which version should I go to?
Thanks
Gary
Most likely you still need to do react-native link
and/or react-native upgrade
.
If choose you downgrade, the most stable version of the UI toolkit that we've tested most extensively is 0.43.4.
Thank you for the quick response Vladimir,
I had done react-native link, it did not help. By the way, I cloned your whole ui and when I tried to run RestaurantsApp
, it failed as well.
below is my package.json
{
"name": "app",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"@shoutem/ui": "^0.21.3",
"mobx": "^3.2.2",
"mobx-react": "^4.2.2",
"react": "16.0.0-alpha.12",
"react-native": "0.48.0",
"react-native-linear-gradient": "^2.3.0",
"react-native-router-flux": "^4.0.0-beta.21"
},
"devDependencies": {
"babel-jest": "20.0.3",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-react-native": "3.0.2",
"jest": "20.0.4",
"react-test-renderer": "16.0.0-alpha.12"
},
"jest": {
"preset": "react-native"
}
}
+1
Here's a workaround for react-native-linear-gradient
if you want to use it with higher versions of React Native.
- Install @shoutem/ui -
npm install @shoutem/ui --save
- Open
MyApp/node_modules/@shoutem/ui/package.json
- Edit line 63 from:
"react-native-linear-gradient": "~2.0.0"
to:
"react-native-linear-gradient": "^2.0.0"
- Remove the current installation of
react-native-linear-gradient
by deleting:
MyApp/node_modules/react-native-linear-gradient
directory. - Run
npm install
from root project directory to install the new version ofreact-native-linear-gradient
Using these steps with React Native 0.48.1 resolved react-native-linear-gradient
issues when building for Android.
We will look for a solution in the UI toolkit, we're working on making it out-of-the-box compatible with higher versions of React Native, for now the most stable version is 0.43.4, any higher than that and we can't guarantee out-of-the-box compliance.
@Vladimir-Vdovic any hope for a better fix ?
We will address this in a future version of the UI toolkit along with other improvements, fixes and features.
Instead of making modifications to @shoutem package.json
one can simply yarn add react-native-linear-gradient --save
from the project folder.
run react-native link and react-native upgrade inside you project then run
react-native run-android/ios
@Awadhesh31 run react-native link and react-native upgrade inside you project then run
react-native run-android/ios
๐ 1
it worked!!!!!!1
But still have some issues with ShoutEm
In my case (react native) was a problem with node_modules. I just remove it and made yarn install
. Probably, they were installed with sudo
so xcode hasn't permissions.