2

I created my first react-native proejct and then ejected by npm run eject but app is failing to compile when I run npm run android and giving me below output and it is showing something wrong in andriod dir and but I don't have any clue what is this symbol import error and how to fix this. I have done lots of search and read but can't find solution to my problem.

I am not a java expert and don't know how to fix this . Please help me to fix this , many thanks

:app:mergeDebugResources UP-TO-DATE
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
C:\Users\iClick Digital\Documents\ZerotoMastery\react-app\my-first-project\android\app\src\main\java\com\mynewproject\MainApplication.java:5: error: cannot find symbol
import com.facebook.react.ReactApplication;
                         ^
  symbol:   class ReactApplication
  location: package com.facebook.react
C:\Users\iClick Digital\Documents\ZerotoMastery\react-app\my-first-project\android\app\src\main\java\com\mynewproject\MainApplication.java:6: error: cannot find symbol
import com.facebook.react.ReactNativeHost;
                         ^
  symbol:   class ReactNativeHost
  location: package com.facebook.react
C:\Users\iClick Digital\Documents\ZerotoMastery\react-app\my-first-project\android\app\src\main\java\com\mynewproject\MainApplication.java:14: error: cannot find symbol
public class MainApplication extends Application implements ReactApplication {
                                                            ^
  symbol: class ReactApplication
C:\Users\iClick Digital\Documents\ZerotoMastery\react-app\my-first-project\android\app\src\main\java\com\mynewproject\MainApplication.java:16: error: cannot find symbol
  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
                ^
  symbol:   class ReactNativeHost
  location: class MainApplication
C:\Users\iClick Digital\Documents\ZerotoMastery\react-app\my-first-project\android\app\src\main\java\com\mynewproject\MainApplication.java:36: error: cannot find symbol
  public ReactNativeHost getReactNativeHost() {
         ^
  symbol:   class ReactNativeHost
  location: class MainApplication
C:\Users\iClick Digital\Documents\ZerotoMastery\react-app\my-first-project\android\app\src\main\java\com\mynewproject\MainActivity.java:5: error: MainActivity is not abstract and does not override abstract method getPackages() in ReactActivity
public class MainActivity extends ReactActivity {
       ^
C:\Users\iClick Digital\Documents\ZerotoMastery\react-app\my-first-project\android\app\src\main\java\com\mynewproject\MainApplication.java:16: error: cannot find symbol
  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
                                                       ^
  symbol:   class ReactNativeHost
  location: class MainApplication
C:\Users\iClick Digital\Documents\ZerotoMastery\react-app\my-first-project\android\app\src\main\java\com\mynewproject\MainApplication.java:35: error: method does not 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
Webappsdeva
  • 327
  • 4
  • 20
  • Have a look at my answer to this question: https://stackoverflow.com/questions/52472658/execution-failed-for-task-appcompiledebugjavawithjavac-while-running-react/52477787?noredirect=1#comment91903787_52477787 Also, just to add - if you try to use the cmd `react-native run-android` this usually works. – JRK Sep 26 '18 at 10:28

0 Answers0