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.
Run Code Online (Sandbox Code Playgroud)
我很确定我没有触及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 react-native:0.57.1
任何人都可以帮我解决这个问题/错误吗?非常感谢!
更新1:25/11/2018(GMT + 8)
通过将所有"编译"替换为"实现"来解决过时的警告
更多细节错误 Unresolved Dependencies ./node_modules/react-native-splash-screen/android/build.gradle
请单击链接查看图像.
react.gradle的react-native-splash-screen/android

Android Studio SYNC错误

更新2:我做了一些事情,转到Android Studio> Gradle,Untick Offline Work
现在我得到了同样的错误,找不到符号,但在Android Studio中显示不同的错误.
找不到符号CMD

Android工作室找不到符号

错误app:compileDebugJavaWithJavac错误

小智 0
第一:使用yarn或npm安装所有依赖项;
第二:使用下面的代码链接iOS和Android原生代码上的原生依赖;
第三:出现这个错误是因为你的RN版本和Android的build.gradle版本不同。当你创建一个react-native应用程序时,可能会创建一个android应用程序,例如:
android/app/build.gradle
因此,检查您的node_modules文件夹,查找react-native文件夹并查找带有数字的文件夹,该数字是react-native版本。对我来说是 0.64.0 然后更新 android/app/build.gradle:
这就是全部。
| 归档时间: |
|
| 查看次数: |
1212 次 |
| 最近记录: |