react-native-linear-gradient 使用安装

汪耀
2023-12-01

今天在使用react-native-linear-gradient的时候遇到了问题,按照官网的做法,居然编译不过去,后来查了网络,不用那么麻烦

1)npm install --save react-native-liner-gradient

2)react-native link react-native-linear-gradient

3)这时候编译会报错

Build file 'E:\working\reactnative\ysj\node_modules\react-native-linear-gradient\android\build.gradle' line: 21错误

去那个文件 改了他

dependencies {

    compileOnly "com.facebook.react:react-native:+"

}

改成

dependencies {

    provided"com.facebook.react:react-native:+"

}

4)再编译还会报错

  1. java.io.IOException: Could not delete path 'E:\working\reactnative\ysj\android\app\build\generated\source\r\debug\android'

错误

去在工程的android下 运行gradlew.bat clean即可

 

 

 

 类似资料: