Weex Project (npm run android)-Error: Error: Command failed
問題描述:
weex項目在運行npm run android跑安卓端時出現(xiàn)以下錯誤,嘗試了網(wǎng)上的很多方法,包括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
問題背景:
①:操作系統(tǒng)Mac
②:已經(jīng)安裝Android Studio并在Android Studio下載模擬器(詳情請百度)
③:已經(jīng)配置jdk并設(shè)置路徑(詳情請百度)
④:已經(jīng)運行yes | sudo ~/Library/Android/sdk/tools/bin/sdkmanager --licenses 同意licenses
解決方法:
網(wǎng)上找的答案都是因為缺少了以上的某一步,對本人沒什么作用,以下方法適用于以上配置都正確的前提下仍然報錯。
仔細看看: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如圖,會發(fā)現(xiàn)報錯的Android SDK build-tools 26.0.0并沒有安裝,點擊安裝后apply ->ok,隨后重新npm run android即可:
結(jié)果:
成功后結(jié)果如右圖模擬器,左邊為npm run ios成功后的效果,至此,weex項目web、iOS、Android三端配置均已完成。
(web端的圖沒截,不用什么配置,關(guān)鍵在于配置iOS及安卓端)
Tips:npm run android 并沒有像npm run ios那樣會自動打開模擬器,而是會報找不到模擬器錯誤,打開Android Studio,啟動安卓模擬器,重新npm run andriod即可。
總結(jié)
以上是生活随笔為你收集整理的Weex Project (npm run android)-Error: Error: Command failed的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 一梦江湖实名认证怎么解除
- 下一篇: 全能计算器app19.0.1 安卓纯净版