React-Native-SVG错误:始终违规:requireNativeComponent:在UIManager中找不到“ RNSVGGroup”

时间:2020-11-11 00:25:20

标签: javascript reactjs react-native svg react-native-svg

我尝试使用react-native-svg在React-Native中创建SVG。我已经设置了一个React-Native-CLI。

我在Google上搜索了一下,并尝试解决自己的问题,然后发现了一些有用的东西。 我尝试cd ios && pod安装。我不知道什么是豆荚,但我用过。而我得到这个错误? Here the Console

因此,我尝试启动我的应用程序,并且出现错误。这里是我的代码,该错误。 ERROR in the Title

import { StyleSheet, Text, View } from 'react-native'
import Svg, { Circle } from 'react-native-svg';


export default class TachoAnzeige extends Component {
    style = StyleSheet.create({
        circle: {
            width: 44,
            height: 44,
            borderRadius: 44/2
         }
    });
    
    render() {
        return (
            <View>
                <Svg height="100" width="100">
                </Svg>
                <Text>CPU_{this.props.cpuid}</Text>
            </View>
        )
    }
}

在react-native-svg中,我看到这可能有用。这是react-native info

System:
    OS: Linux 5.8 Manjaro Linux
    CPU: (4) x64 Intel(R) Core(TM) i5 CPU       M 560  @ 2.67GHz
    Memory: 235.25 MB / 7.63 GB
    Shell: 5.0.18 - /bin/bash
  Binaries:
    Node: 15.0.1 - /usr/bin/node
    Yarn: Not Found
    npm: 6.14.8 - /usr/bin/npm
    Watchman: Not Found
  SDKs:
    Android SDK:
      API Levels: 29, 30
      Build Tools: 28.0.3, 30.0.2
      System Images: android-22 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: Not Found
  Languages:
    Java: 1.8.0_265 - /usr/bin/javac
    Python: 3.8.6 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: ^16.13.1 => 16.14.0 
    react-native: 0.63.3 => 0.63.3 
  npmGlobalPackages:
    *react-native*: Not Found
在npmGlobalPackages上安装了

react-native Android Studio也已安装。

解决:完全在物理电话和仿真器上重新安装该应用程序。

1 个答案:

答案 0 :(得分:0)

解决方案:

  1. 我从 Android 设备卸载了应用程序,然后运行
  2. npx react-native run-android

OR 根据您的设置,您可以运行 2. react-native run-android

它有效