首页 > 解决方案 > 我如何构建 react-native 应用程序以避免导致失败的许多重大更改?

问题描述

我刚刚使用已成功创建的 npx create-react-native-app myapp 创建了一个新的 react-native 应用程序。但是当我尝试使用 gradlew assembleRelease 构建它时,我收到了这个错误

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.
> Failed to find Platform SDK with path: platforms;android-30

* 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 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 43s

似乎有一个gradle问题。我如何解决它?

标签: react-native

解决方案


我发现构建反应原生应用程序的完美方法是使用命令“assembleRelease”。这会构建您的代码并为您提供一个 apk


推荐阅读