android - 失败 : Build failed with an exception. React Native

标签 android react-native android-sdk-manager

尝试使用

构建我的 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 Studio 构建这个 React-native 应用。

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

项目打开后,Android Studio 会提示“更新”需要跳过。 使用下载 SDK 对话框,您接受并继续

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

关于android - 失败 : Build failed with an exception. React Native,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52630283/

相关文章:

Android - 如何删除扩展文件?

android - sdkmanager版本程序包未签名

android - 对话框自定义宽高问题

java - 当我尝试使用图像按钮进入第二个 Activity 时应用程序崩溃

java - “PKIX 路径构建失败 - 无法找到到请求目标的有效证书路径”(在具有身份验证的公司代理后面)

android - Bootstrap 方法返回 null - Android 在启动时立即崩溃

Android Studio 2.3 Canary 在 'Launch Standalone SDK Manager' 中缺少 'SDK Manager' 选项

Android SDK Manager - 你需要安装所有的 Android 平台吗?

image - 设置 ListView 的背景

javascript - 在 React Native Webview 中使用本 map 片