简体   繁体   English

依赖react-native-svg在android中不起作用

[英]Dependency react-native-svg is not working in android

I have added react-native-svg using command "npm install react-native-svg --save" But when I run my app using command "react-native run-android" it is showing following error. 我已经使用命令“ npm install react-native-svg --save”添加了react-native-svg,但是当我使用命令“ react-native run-android”运行我的应用程序时,显示以下错误。

  • Where: Build file '/Users/gireesh/Desktop/TCSOccasions/old/TCSOccasions/android/app/build.gradle' line: 140 其中:构建文件'/Users/gireesh/Desktop/TCSOccasions/old/TCSOccasions/android/app/build.gradle'行:140

  • What went wrong: A problem occurred evaluating project ':app'. 出了什么问题:评估项目':app'时发生问题。

    Project with path ':react-native-svg' could not be found in project ':app'. 在项目':app'中找不到路径为':react-native-svg'的项目。

Here is my package.json file dependencies. 这是我的package.json文件依赖项。

"dependencies": { "axios": "^0.18.0", "native-base": "^2.7.0", "react": "16.4.1", "react-native": "0.56.0", "react-native-qrcode-svg": "^5.1.0", "react-native-svg": "^6.4.1", "react-navigation": "^2.6.2" }, “ dependencies”:{“ axios”:“ ^ 0.18.0”,“ native-base”:“ ^ 2.7.0”,“ react”:“ 16.4.1”,“ react-native”:“ 0.56.0” ,“ react-native-qrcode-svg”:“ ^ 5.1.0”,“ react-native-svg”:“ ^ 6.4.1”,“ react-navigation”:“ ^ 2.6.2”},

I am using "react-native-svg" for "react-native-qrcode-svg" to generate qrcode from a string. 我正在将“ react-native-svg”用于“ react-native-qrcode-svg”,以从字符串生成qrcode。 It is working fine in IOS the problem occurs only with android. 它在IOS上运行正常,问题仅在android上出现。 Can some one please help me?? 有人可以帮帮我吗??

You also have to link the dependency using react-native link react-native-svg or manually adding the native dependency inside of gradle config files and java code. 您还必须使用react-native link react-native-svg来链接依赖项,或者在gradle config filesjava代码中手动添加本地依赖项。

it is on the readme here 它在这里的自述文件中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM