React-Native Android Studio构建失败

时间:2019-02-26 04:08:34

标签: android react-native gradle

当我执行build-> rebuild project时,android studio中的构建失败。我在下面发布了错误消息。这很奇怪,因为我没有进行任何更改,我所尝试的只是创建一个新的AVD,而接下来您尝试构建它会导致错误。现在我无法运行它。我不愿意尝试一些随机的快速修复方法,因为在我创建新的AVD之前,一切工作都很好。

> Task :app:compileDebugJavaWithJavac FAILED
/Users/waltershub/Desktop/Fluz-Develop/fluzfluz-frontend/fluzclient/android/app/src/main/java/com/fluzclient/MainApplication.java:22: error: cannot find symbol
import io.branch.referral.Branch;
                         ^
  symbol:   class Branch
  location: package io.branch.referral
/Users/waltershub/Desktop/Fluz-Develop/fluzfluz-frontend/fluzclient/android/app/src/main/java/com/fluzclient/MainApplication.java:98: error: cannot find symbol
    Branch.getAutoInstance(this);
    ^
  symbol:   variable Branch
  location: class MainApplication
Note: /Users/waltershub/Desktop/Fluz-Develop/fluzfluz-frontend/fluzclient/android/app/src/main/java/com/fluzclient/MainActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 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.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.0-milestone-1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 19s
409 actionable tasks: 381 executed, 28 up-to-date

1 个答案:

答案 0 :(得分:0)

分支SDK 未正确导入到您的React项目中。

https://docs.branch.io/pages/apps/react-native/

遵循YARN安装以在项目中添加依赖项。