Cannot resolve symbol ReactApplication/ReactNativeHost

Deadly 提交于 2019-11-30 17:39:05

It happened to me too after detach my react-native project from Expo.

In MainApplication I had "error Cannot resolve symbol" for these imports:

import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;

in my package.json file I used:

"react-native": "https://github.com/expo/react-native/archive/sdk-29.0.0.tar.gz",

the problem was that the android can't find the directory for node_modules like that.

in order to fix the issue I had to:

  1. change it to :

    "react-native": "^0.57.8",

  2. delete node_modules file

  3. run npm install
  4. delete .gradle folder from android project and sync project.

That's what solved the problem for me. Hope I helped.

Upgrade react-native :

react-native upgrade

I solved it by upgrading react-native, react-native-cli, gradle plugin to last version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!