![](/img/trans.png)
[英]Invariant Violation: requireNativeComponent: "RNSVGSvgViewAndroid" was not found in the UIManager in Android
[英]React-Native-SVG Error: Invariant Violation: requireNativeComponent: "RNSVGGroup" was not found in the UIManager
我嘗試使用 react-native-svg 在 React-Native 中創建一個 SVG。 我已經設置了一個 React-Native-CLI。
我谷歌了一下並嘗試自己解決它,我找到了一些有用的東西。 我嘗試 cd ios && pod install。 我不知道 pod 是什么,但我用過它。 我收到這個錯誤? 這里是控制台
所以,我嘗試啟動我的應用程序,但錯誤來了。 這是我的代碼,執行錯誤。 標題錯誤
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。
解決:在物理電話和模擬器上完成重新安裝應用程序。
解決方案:
npx react-native run-android
或根據您的設置,您可以運行 2. react-native run-android
它有效
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.