C:\Users\Alex\testing\firsttry>react-native run-android
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Starting a Gradle Daemon (subsequent builds will be faster)
> Configure project :app
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
> Configure project :react-native-splash-screen
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
> Task :app:compileDebugJavaWithJavac
C:\Users\Alex\testing\firsttry\android\app\src\main\java\com\firsttry\MainApplication.java:5: error: cannot find symbol
import com.facebook.react.ReactApplication;
^
symbol: class ReactApplication
location: package com.facebook.react
C:\Users\Alex\testing\firsttry\android\app\src\main\java\com\firsttry\MainApplication.java:9: error: cannot find symbol
import com.facebook.react.ReactNativeHost;
^
symbol: class ReactNativeHost
location: package com.facebook.react
C:\Users\Alex\testing\firsttry\android\app\src\main\java\com\firsttry\MainApplication.java:17: error: cannot find symbolpublic class MainApplication extends Application implements ReactApplication {
^
symbol: class ReactApplication
C:\Users\Alex\testing\firsttry\android\app\src\main\java\com\firsttry\MainApplication.java:19: error: cannot find symbol private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
^
symbol: class ReactNativeHost
location: class MainApplication
C:\Users\Alex\testing\firsttry\android\app\src\main\java\com\firsttry\MainActivity.java:7: error: MainActivity is not abstract and does not override abstract method getPackages() in ReactActivity
^
C:\Users\Alex\testing\firsttry\android\app\src\main\java\com\firsttry\MainApplication.java:19: error: cannot find symbol private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
^
symbol: class ReactNativeHost
location: class MainApplication
C:\Users\Alex\testing\firsttry\android\app\src\main\java\com\firsttry\MainApplication.java:41: error: method does not override or implement a method from a supertype
@Override
^
8 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
I am pretty sure I did not touch anything in the MainApplication.java & MainActivity.java And I am running it on a virtual Android phone.
C:\Users\Alex\testing\firsttry>npm -v 6.4.1
C:\Users\Alex\testing\firsttry>react-native -v react-native-cli: 2.0.1 react-native: 0.57.1
Can anyone help me with this problem/error? Thank you so much!
Update 1: on 25/11/2018 (GMT+8)
Solved WARNING of obsolete by replacing all 'compile' to 'implementation'
More detail of the error Unresolved Dependencies ./node_modules/react-native-splash-screen/android/build.gradle
Please click on the link to view the image.
build.gradle of react-native-splash-screen/android
Android Studio SYNC Error
Update 2: I did something by going to Android Studio > Gradle, Untick Offline Work
Now I got the same error of cannot find symbol but different error show in Android Studio.
Cannot find symbol CMD
Android studio cannot find symbol
Error of app:compileDebugJavaWithJavac
error