Weex Project (npm run android)->Error: Error: Command failed

版权声明:本文为博主原创文章,转载请注明出处。 https://blog.csdn.net/Fabulous1111/article/details/86576085

问题描述:

weex项目在运行npm run android跑安卓端时出现以下错误,尝试了网上的很多方法,包括Stack Overflow上的大神的建议依然没有解决,问题如下:

Error: Error: Command failed: ./gradlew  assembleDebug

isLibProject: false, isAppProject: true

weex_plugin: []  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].

  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

问题背景:

①:操作系统Mac

②:已经安装Android Studio并在Android Studio下载模拟器(详情请百度)

③:已经配置jdk并设置路径(详情请百度)

④:已经运行yes | sudo ~/Library/Android/sdk/tools/bin/sdkmanager --licenses 同意licenses

解决方法:

网上找的答案都是因为缺少了以上的某一步,对本人没什么作用,以下方法适用于以上配置都正确的前提下仍然报错。

仔细看看: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.

按照这个意思,打开Android Studio的SDK管理器,点击SDK Tools,点击Show Package Details如图,会发现报错的Android SDK build-tools 26.0.0并没有安装,点击安装后apply ->ok,随后重新npm run android即可:

结果:

成功后结果如右图模拟器,左边为npm run ios成功后的效果,至此,weex项目web、iOS、Android三端配置均已完成。

(web端的图没截,不用什么配置,关键在于配置iOS及安卓端)

Tips:npm run android 并没有像npm run ios那样会自动打开模拟器,而是会报找不到模拟器错误,打开Android Studio,启动安卓模拟器,重新npm run andriod即可。

猜你喜欢

转载自blog.csdn.net/Fabulous1111/article/details/86576085
今日推荐