失败:构建失败,发生异常。 ReactNative

时间:2018-10-03 15:12:51

标签: 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

我该如何解决?

1 个答案:

答案 0 :(得分: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直接运行应用 enter image description here enter image description here

相关问题