React-native: Cannot find symbol class ReactApplication

Created on 19 Jul 2016  路  14Comments  路  Source: facebook/react-native

Hi,
I've successfully created the iOS component with React Native and now porting to Android. I've successfully rnpm all libraries and when I run-android, I get:

cannot find symbol
import com.facebook.react.ReactApplication;
^
symbol: class ReactApplication
location: package com.facebook.react

cannot find symbol
import com.facebook.react.ReactNativeHost;
^
symbol: class ReactNativeHost
location: package com.facebook.react

: method does not override or implement a method from a supertype
@Override

How do I find my android component so that the compiler can find these symbols? Thanks.

Locked

Most helpful comment

I had this issue because I was using react-native directly from the git master url instead of an npm version.

All 14 comments

+1

+1

this got resolved for me when i upgraded to react-native 0.29.2, cleared gradle's cached files and rebuilt. (though for some reason ./gradlew clean wasn't enough. I'm honestly not sure what was the final straw that forced it to stop using a cached ReactActivity and ReactApplication classes).

@mvayngrib Hey, I upgraded to 0.29.2, deleted .gradled and ran react-native run-android. Those were my exact steps. Did you build in Android Studio? Or did you run react-native upgrade? Please let me know. Thanks so much.

sadly, all of the above. run-android kept giving me errors about not implementing some abstract method of ReactActivity that doesn't exist in the new version, and gradlew clean wasn't helping for some reason. Android Studio would link to a ReactActivity class in an older-version react-native jar in an intermediate build from one of my dependencies. Not sure what exactly tipped the scales in the end

@mvayngrib would you have any other pieces of advice to give me? Or can you paste in the exact order and list of commands you ran? I'm up to 0.29.2 and cleared .gradled folder. Is there anything you ran in Android Studio? I simply did npm i --save [email protected] and deleted the folder. and then ran react-native run-android. Thanks.

@mhoanghold Try running ./gradlew clean inside the android/ folder.

Yeah I ran that and same errors about unfound symbols. @satya164 What else can you recommend? Are you on RN 0.30?

@mhoanghold yes. can you share a sample project?

@DannyvanderJagt Would you have any insight here? Thanks

@mhoanghold I'm sorry I don't have any experience with Android. Try to ask one of the facebook/react-native team, they can probably help you.

This question would be better suited for StackOverflow.

However, it looks like your error is not in your imports. You're missing an override method from one of the interfaces you're implementing. The exact method you need to override would be listed right after the last line in the error log you posted.

@facebook-github-bot stackoverflow

I had this issue because I was using react-native directly from the git master url instead of an npm version.

Was this page helpful?
0 / 5 - 0 ratings