1

I am experiencing the following problem when trying to install NativeBase for my React Native project on Windows 10

  1. react-native init RNapp cd RNapp
  2. npm install native-base --save
  3. react-native link react-native-vector-icons
  4. Edit android/app/build.gradle and add the followingto the end of file:
    apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

Running echo %JAVA_HOME% gives C:\Program Files\Java\jdk1.8.0_111

Now when I run

react-native run-android

the build fails with the following error. Is there a solution to this problem?

C:\Users\y\RNapp\android\app\src\main\java\com\rnapp\MainApplication.java:6: error: cannot find s
mbol
import com.facebook.react.ReactApplication;
                         ^
  symbol:   class ReactApplication
  location: package com.facebook.react
C:\Users\y\RNapp\android\app\src\main\java\com\rnapp\MainApplication.java:9: error: cannot find s
mbol
import com.facebook.react.ReactNativeHost;
                         ^
  symbol:   class ReactNativeHost
  location: package com.facebook.react
C:\Users\y\RNapp\android\app\src\main\java\com\rnapp\MainApplication.java:17: error: cannot find
ymbol
public class MainApplication extends Application implements ReactApplication {
                                                            ^
  symbol: class ReactApplication
C:\Users\y\RNapp\android\app\src\main\java\com\rnapp\MainApplication.java:19: error: cannot find
ymbol
  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
                ^
  symbol:   class ReactNativeHost
  location: class MainApplication
C:\Users\y\RNapp\android\app\src\main\java\com\rnapp\MainApplication.java:35: error: cannot find
ymbol
  public ReactNativeHost getReactNativeHost() {
         ^
  symbol:   class ReactNativeHost
  location: class MainApplication
C:\Users\y\RNapp\android\app\src\main\java\com\rnapp\MainActivity.java:5: error: MainActivity is
ot abstract and does not override abstract method getPackages() in ReactActivity
public class MainActivity extends ReactActivity {
       ^
C:\Users\y\RNapp\android\app\src\main\java\com\rnapp\MainApplication.java:19: error: cannot find
ymbol
  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
                                                       ^
  symbol:   class ReactNativeHost
  location: class MainApplication
C:\Users\y\RNapp\android\app\src\main\java\com\rnapp\MainApplication.java:34: error: method does
ot override or implement a method from a supertype
  @Override
  ^
8 errors
:app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 6.098 secs
4
  • Cannot find symbol - you're missing dependencies Commented Dec 10, 2016 at 17:38
  • Also looks like a reported error, but hasn't been addressed on Github for a solution. github.com/facebook/react-native/issues/8902 Commented Dec 10, 2016 at 17:41
  • @cricket_007 I believe there must be many people who are using this without problem.... Any suggestions what changes should I make to the project, like moving back to a specific version of react-native etc... Commented Dec 10, 2016 at 17:50
  • I'm not sure. Haven't used that library. I would check which version your Gradle file is trying to use, then look at the github source code to see if those classes exist in the react native android code Commented Dec 10, 2016 at 17:53

1 Answer 1

1

Updated react-native-cli from 1.3.0 to 2.0.0, recreated react-native project. Everything works now.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.