当前位置: 首页 > 知识库问答 >
问题:

失败:生成失败,React Native Android中出现异常

严阳秋
2023-03-14

我正在使用react-native cli:1.2.0、react-native:0.40.0和Ubuntu 16.04。

我试图实现与Android应用程序的反应原生导航,但它给我一个错误如下:

降级到react native 0.25.1后,我有以下问题:

/home/dinesh/Desktop/Dineshaws/android/app/src/main/java/com/dineshaws/MainApplication.java:6: error: cannot find symbol
import com.facebook.react.ReactApplication;
                         ^
  symbol:   class ReactApplication
  location: package com.facebook.react
/home/dinesh/Desktop/Dineshaws/android/app/src/main/java/com/dineshaws/MainApplication.java:8: error: cannot find symbol
import com.facebook.react.ReactNativeHost;
                         ^
  symbol:   class ReactNativeHost
  location: package com.facebook.react
/home/dinesh/Desktop/Dineshaws/android/app/src/main/java/com/dineshaws/MainApplication.java:16: error: cannot find symbol
public class MainApplication extends Application implements ReactApplication {
                                                            ^
  symbol: class ReactApplication
/home/dinesh/Desktop/Dineshaws/android/app/src/main/java/com/dineshaws/MainApplication.java:18: error: cannot find symbol
  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
                ^
  symbol:   class ReactNativeHost
  location: class MainApplication
/home/dinesh/Desktop/Dineshaws/android/app/src/main/java/com/dineshaws/MainApplication.java:33: error: cannot find symbol
  public ReactNativeHost getReactNativeHost() {
         ^
  symbol:   class ReactNativeHost
  location: class MainApplication
/home/dinesh/Desktop/Dineshaws/android/app/src/main/java/com/dineshaws/MainApplication.java:18: error: cannot find symbol
  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
                                                       ^
  symbol:   class ReactNativeHost
  location: class MainApplication
/home/dinesh/Desktop/Dineshaws/android/app/src/main/java/com/dineshaws/MainApplication.java:32: error: method does not override or implement a method from a supertype
  @Override
  ^
7 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

Total time: 35.645 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

共有1个答案

宗冠宇
2023-03-14

React Native存在com.facebook.react.LifeCycleState的最后一个版本是0.34. x,所以这个模块不能在react-local上使用

其实我可以看到v2分支,仔细阅读!

更新:主项目页面上存在有关支持的React Native版本的相同描述

 类似资料:
  • AGPBI:{“kind”:“error”,“text”:“Android资源链接失败”,“sources”:[{}],“original”:“error::AAPT:D:\Android basics kotlin cupcake app starter\app\build\intermediates\processed\u res\debug\out\resources-debug.ap\:错

  • 我的项目中出现了以下错误:`Failure:生成失败,出现异常。 > 其中:设置文件'/home/kaizar/music/oreo-fashion-v2.3.0/app/rn_oreo/android/Settings.gradle'行:4 错误:评估设置“rn_oreo”时出现问题。 请访问https://help.gradle.org获取更多帮助

  • 最近我在eclipse上建立了一个Minecraft Forge工作区。我在过去用forge(MC1.6.4等等)创建了minecraft MOD,尽管从那以后有了很大的变化。我正在尝试使用Forge1.15.2-31.1.0 mdk和JDK 1.8.0_241进行修改 我创建了一个RunClient。bat文件,用于编译和构建我的项目 它完全编译到98%,然后崩溃。这是我的事故报告: --UPD

  • 当我运行时,我的构建失败了,我收到了以下消息: 失败:生成失败,出现异常。 > 错误:配置根项目“RxRedux”时出现问题。 无法解析配置“:classpath”的所有文件。找不到com。Android工具。构建:gradle:3.0。1.在以下位置搜索:https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle

  • 我正在尝试创建我的第一个颤振应用程序,但当我运行它时,它会给我这个错误 失败:生成失败,出现异常。 > 无法打开设置文件'C:\JavaDemos\sea_ok\android\settings.gradle'的设置通用类缓存(C:\用户\Emre.gradle\缓存\5.6.2\脚本\b4ieilm7vkknhwvoai8y4gzba\设置\settins8410a2d21ed2f87c8a03

  • 当我尝试时,我出现了以下错误…有人能帮忙吗? 失败:生成失败,出现异常。 null 请访问https://help.gradle.org获取更多帮助 生成在12s运行分级任务“汇编发布”时失败...正在运行分级任务“汇编发布”...已完成13.3s分级任务AssemblereRease失败,退出代码为%1