【问题标题】:FAILURE: Build failed with an exception. ReactNativeFAILURE:构建失败并出现异常。反应原生
【发布时间】:2018-10-03 15:12:51
【问题描述】:

尝试使用

构建我的 android 项目

react-native run-android

但是,我不断收到同样的错误:

Warning: License for package Android SDK Platform 26 not accepted.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> You have not accepted the license agreements of the following SDK 
components:
[Android SDK Platform 26, Android SDK Build-Tools 26.0.2].
Before building your project, you need to accept the license agreements and 
complete the installation of the missing components using the Android Studio 
SDK Manager.
Alternatively, to learn how to transfer the license agreements from one 
workstation to another, go to http://d.android.com/r/studio-ui/export- 
licenses.html

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

BUILD FAILED

我尝试过的:

  1. 我尝试使用sdkmanager --licenses 接受所有许可
  2. 我更新了我的 SDK
  3. 我使用git clean -d -fx 清理了我的项目
  4. 我确保安装了最新的 Android SDK

我该如何解决这个问题?

【问题讨论】:

    标签: android react-native android-sdk-manager


    【解决方案1】:

    我建议你通过 Android Studio 构建这个 React-native 应用。

    使用 Android Studio 打开项目文件夹 /android 中的 Android 项目。

    项目打开后Android Studio会提示"update"need skip。 与dialog for download SDK, you accept and continue

    完成设置后,您可以通过菜单 Build\Build APK 构建您的 RN Android 或通过菜单 Run\Run App 直接运行应用程序

    【讨论】:

    • 它对我有用。我在 Android Studio 中成功构建了 APK,然后我继续使用 VS Code。我想我只需要设置一些 Android Studio 在后台做的事情。谢谢
    • 是的,Android Studio 会在后台做很多事情。并且使用 Android Studio 构建,我们可以更轻松地跟踪构建错误。如果这个答案是正确的,请投票并标记为正确。谢谢
    猜你喜欢
    • 2018-06-05
    • 2018-07-28
    • 2018-10-22
    • 1970-01-01
    • 2018-10-29
    • 2020-06-13
    • 2021-09-24
    • 2016-05-18
    相关资源
    最近更新 更多