React-Native编译错误:找不到符号

时间:2018-11-24 10:40:22

标签: react-native

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.

我很确定我没有触摸 MainApplication.java MainActivity.java 中的任何内容 我正在虚拟的Android手机上运行它。

  

C:\ Users \ Alex \ testing \ firsttry> npm -v   6.4.1

     

C:\ Users \ Alex \ testing \ firsttry> react-native -v   react-native-cli:2.0.1   反应本机:0.57.1​​

有人可以帮助我解决这个问题吗?非常感谢!

  

更新1:2018年11月25日(GMT + 8)

通过将所有“编译”替换为“实现”来解决过时的警告

该错误的更多详细信息 未解决的依存关系 ./node_modules/react-native-splash-screen/android/build.gradle

请单击链接以查看图像。

react-native-splash-screen / android的build.gradle

Android Studio同步错误

  

更新2:我做了一些操作,方法是转到Android Studio> Gradle,取消选中离线工作

现在我遇到了相同的错误:找不到符号,但是在Android Studio中显示了不同的错误。

找不到符号CMD

Android Studio找不到符号

app:compileDebugJavaWithJavac错误

0 个答案:

没有答案