A. L
A. L

Reputation: 12669

React-native: RNSvgPackage() error

So I'm getting an error (at the bottom) that's most likely caused by me trying uninstalling react-native-pathjs-charts. The problem below only exists on android and not on ios.

Error:

/Users/a.lau/Projects/react-native/First_App/android/app/src/main/java/com/first_app/MainApplication.java:7: error: cannot find symbol import com.horcrux.svg.RNSvgPackage; ^ symbol: class RNSvgPackage location: package com.horcrux.svg /Users/a.lau/Projects/react-native/First_App/android/app/src/main/java/com/first_app/MainApplication.java:29: error: cannot find symbol new RNSvgPackage() ^ symbol: class RNSvgPackage 2 errors :app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 5.997 secs Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/android-setup.html

Upvotes: 0

Views: 2567

Answers (3)

Doan Bui
Doan Bui

Reputation: 4436

Run with yarn add package_name is helped me.

Upvotes: 0

QuarK
QuarK

Reputation: 2536

Also have in mind that the package was changed from:

import com.horcrux.svg.RNSvgPackage;

to

import com.horcrux.svg.SvgPackage;

so you have to change from new RNSvgPackage() to new SvgPackage()

hope it helps!

Upvotes: 3

vinayr
vinayr

Reputation: 11244

I guess you did not unlink before uninstalling the module. Install again, unlink and then uninstall the module.

npm install react-native-pathjs-charts --save
react-native unlink react-native-svg
npm remove react-native-pathjs-charts --save

Upvotes: 2

Related Questions