iconfont-cli / taro-iconfont-cli

在Taro框架中使用iconfont图标,支持多端,支持多色彩,不依赖字体。
MIT License
355 stars 49 forks source link

错误: 找不到符号 #11

Closed ANDYGE closed 4 years ago

ANDYGE commented 4 years ago

在安装了react-native-svg之后,出现了很多”错误: 找不到符号“的错误,大神,该怎么破啊?

/Users/geshaofei/Desktop/ss/taro-native-shell/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/Svg
View.java:24: 错误: 找不到符号
import androidx.annotation.NonNull;
                          ^
  符号:   类 NonNull
  位置: 程序包 androidx.annotation
/Users/geshaofei/Desktop/ss/taro-native-shell/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/For
eignObjectView.java:17: 错误: 找不到符号
import androidx.annotation.NonNull;
                          ^
  符号:   类 NonNull
  位置: 程序包 androidx.annotation
/Users/geshaofei/Desktop/ss/taro-native-shell/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/SvgView.java:113: 错误: 找不到符号
    public void onDescendantInvalidated(@NonNull View child, @NonNull View target) {
ANDYGE commented 4 years ago

已解决,在taro-native-shell/node_modules/react-native-svg/android/build.gradle 中添加如下依赖:

dependencies {
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:${safeExtGet('reactnativeVersion', '+')}"
    // new add
    implementation 'androidx.annotation:annotation:1.1.0'
}
fwh1990 commented 4 years ago

请问现在用的哪个版本的RN?如果是0.60以前的,就会有androidx的问题

ANDYGE commented 4 years ago

我用的是Taro框架指定RN为:0.55.4

ANDYGE commented 4 years ago

非常感谢taro-iconfont-cli的分享。