0

I've had the error when trying to display a AreaChart in react-native that No View Manager defined for class RNSVGLine and found that for many people linking react-native to react-native-svg solved this issue. For me it just made me achieve a build error.

Unlinking it solves the build problem, but it is back to the previous error.

import { AreaChart } from 'react-native-svg-charts'

This is the import and the package and it is installed using npm.

return (
        <AreaChart
            style={ { height: 200 } }
            dataPoints={ data }
            fillColor={ 'rgba(134, 65, 244, 0.2)' }
            strokeColor={ 'rgb(134, 65, 244)' }
            contentInset={ { top: 30, bottom: 30 } }
            curve={shape.curveNatural}
        />
    );

and this is where I try to render it.

I have no more ideas of what to do, going in the MainApplication.java and manually importing it does not solve the problem for me.

Paul
  • 121
  • 1
  • 8
  • What is the build error that you are getting after linking the two? – CRice Dec 08 '17 at 21:37
  • Execution failed for task ':app:processDebugResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt – Paul Dec 08 '17 at 21:42
  • Was there a more specific message listed directly after that? I encountered the same error myself earlier, (aapt failed), and in my case increasing the compile sdk version (in the app level build.gradle) fixed it. So you might try that. However, I can't be sure if you have the same issue unless there is something more specific in the failure message. – CRice Dec 08 '17 at 21:47
  • No that was the only error message. The only tips were to use --stacktrace or --debug – Paul Dec 08 '17 at 21:51
  • At what sdk did it fix it? I am currently at 23. – Paul Dec 08 '17 at 21:58
  • I went from 25 to 26. But 27 is the most recent. – CRice Dec 08 '17 at 22:01
  • When debugging I've found this Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored' and other widgets. – Paul Dec 08 '17 at 22:19
  • Not sure about that one but check out [this question](https://stackoverflow.com/questions/32075498/error-retrieving-parent-for-item-no-resource-found-that-matches-the-given-name). Looks like it might be a version mismatch issue. – CRice Dec 08 '17 at 22:25

1 Answers1

0

The problem was that the compiled library version was not the same as the support library version. This was set in the android/build.gradle and app/build.gradle and in the .json file. After that linking react-native to react-native-svg no longer had the build error and worked.

Paul
  • 121
  • 1
  • 8