'MainActivity.java - cannot find symbol reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED)

I've upgraded react-native to latest version (0.68) through react-native CLI, and now every time I'm trying to build for android I get this error: error: cannot find symbol reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);

I tried to clean the bundle, made sure my package name is correct (like others issues suggested) and nothing so far..



Solution 1:[1]

Going through react-native migrations file, I've found out that somehow I missed a few migrations related to react-native new architecture (although I would expect it to be automatic when using react-native CLI upgrade command).

I suggest to follow the migrations changes especially on MainActivity.java and MainApplication.java - don't forget to change the "from" and "to" versions to your case:

https://react-native-community.github.io/upgrade-helper/?from=0.65.1&to=0.68.1

Solution 2:[2]

If you're using the latest version of React Native (i.e: v >= 68), you've to rebuild your projects. it works for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MasterPiece
Solution 2 Md. Jamal Uddin