我创建了我的第一个react-native过程,然后被npm run eject
弹出,但是当我运行npm run android
并在输出以下给我时,应用无法编译,并且在andriod目录中显示了错误,但是我不知道此符号导入错误是什么以及如何解决。我已经进行了大量搜索和阅读,但是找不到解决我问题的方法。
我不是Java专家,也不知道如何解决此问题。请帮助我解决此问题,非常感谢
: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