如果大家在cordova的项目中执行: cordova build android 命令, 遇到如下问题:
Error: Command failed: cd /Users/tyler/workspace/webstormspace/NewsApp/releases/dev/www && cordova build android Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes precedence. java.lang.IllegalStateException: buildToolsVersion is not specified. at com.google.common.base.Preconditions.checkState(Preconditions.java:173) at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:645) at com.android.build.gradle.BasePlugin 10.call(BasePlugin.java:608)atcom.android.build.gradle.BasePlugin 10.call(BasePlugin.java:605) at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156) at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:120) at com.android.build.gradle.BasePlugin.lambda createTasks 1(BasePlugin.java:603) at com.android.build.gradle.BasePlugin$$Lambda$29/1202404165.execute(Unknown Source) at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDisError: Command failed: cd /Users/tyler/workspace/webstormspace/NewsApp/releases/dev/www && cordova build android
解决办法是:
更新你的Android SDK build tools, 到最新版本即可,可能你更新了android platform。