Reputation: 2989
I was using react-native 0.59.1 and recently migrated to react-native 0.61.5 after that when I run react-native run-android
I get the following error.
Even with the error the project builds and run properly.
I have heard about auto-linking and as suggested in the error I have unlinked the dependency using the command shown in the error and also run react-native link
. After that, the project builds and works fine in iOS but throwing the following error in Android
Upvotes: 3
Views: 1468
Reputation: 2989
It was a problem with my react-native upgrade. I haven't updated the MainApplication.java
file properly. I have fixed it by updating getPackages()
method in MainApplication.java
file as follow
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
return packages;
}
Now everything works properly.
Upvotes: 1
Reputation: 41
First, you need to try to run react-native unlink netinfo
. Once you've unlinked the library you should use cocoapods
, not react-native link ...
. This is because in React Native v0.61 you no longer manually link 3rd party libraries. Try running:
cd ios
pod install
Upvotes: 4