This is the exact error I've been getting;
F:\XXX\XXX\XXX\myApp-1>cordova build android
ANDROID_HOME=L:\android-sdks
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_45
Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configur
ation failure takes precedence.
java.lang.IllegalStateException: buildToolsVersion is not specified.
at com.google.common.base.Preconditions.checkState(Preconditions.java:17
6)
at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.jav
a:599)
at com.android.build.gradle.BasePlugin$10$1.call(BasePlugin.java:566)
at com.android.build.gradle.BasePlugin$10$1.call(BasePlugin.java:563)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.ja
va:55)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.ja
va:47)
at com.android.build.gradle.BasePlugin$10.execute(BasePlugin.java:562)
at com.android.build.gradle.BasePlugin$10.execute(BasePlugin.java:559)
at org.gradle.listener.BroadcastDispatch$ActionInvocationHandler.dispatc
h(BroadcastDispatch.java:109)
at org.gradle.listener.BroadcastDispatch$ActionInvocationHandler.dispatc
h(BroadcastDispatch.java:98)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java
:83)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java
:31)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocat
ionHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy12.afterEvaluate(Unknown Source)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfte
rEvaluate(LifecycleProjectEvaluator.java:79)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(L
ifecycleProjectEvaluator.java:65)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProj
ect.java:504)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProj
ect.java:83)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(Task
PathProjectEvaluator.java:42)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuil
dConfigurer.java:35)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(Default
GradleLauncher.java:129)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradle
Launcher.java:106)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLaun
cher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildCon
troller.run(InProcessBuildActionExecuter.java:80)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.jav
a:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.jav
a:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProce
ssBuildActionExecuter.java:36)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProce
ssBuildActionExecuter.java:26)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBu
ild.java:47)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(Build
CommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed
(DaemonCommandExecution.java:119)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(
WatchForDisconnection.java:35)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed
(DaemonCommandExecution.java:119)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute
(ResetDeprecationLogger.java:24)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed
(DaemonCommandExecution.java:119)
at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execut
e(StartStopIfBuildAndStop.java:33)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed
(DaemonCommandExecution.java:119)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(Forw
ardClientInput.java:71)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(Forw
ardClientInput.java:69)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(For
wardClientInput.java:69)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed
(DaemonCommandExecution.java:119)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClien
t.java:60)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(Build
CommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed
(DaemonCommandExecution.java:119)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBu
ild(EstablishBuildEnvironment.java:70)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(Build
CommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed
(DaemonCommandExecution.java:119)
at org.gradle.launcher.daemon.server.exec.DaemonHygieneAction.execute(Da
emonHygieneAction.java:39)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed
(DaemonCommandExecution.java:119)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.
run(StartBuildOrRespondWithBusy.java:46)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(Daemon
StateCoordinator.java:246)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecut
orImpl$1.run(DefaultExecutorFactory.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:617)
at java.lang.Thread.run(Thread.java:745)
FAILURE: Build failed with an exception.
* Where:
Script 'F:\XXX\XXX\XXX\myApp-1\platforms\android\Cordova
Lib\cordova.gradle' line: 40
* What went wrong:
A problem occurred evaluating root project 'android'.
> cordova_9wgvcsxf5r9stvckgd0tfi8q2$_getAvailableBuildTools_closure3
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
BUILD FAILED
Total time: 10.712 secs
Error: Error code 1 for command: cmd with args: /s,/c,""F:\XXX\XXX\XXX\myApp-1\platforms\android\gradlew" cdvBuildDebug -b "F:\XXX
\XXX\XXX\myApp-1\platforms\android\build.gradle" -Dorg.gradle.
daemon=true -Pandroid.useDeprecatedNdk=true"
I've read the different solutions posted for this issue here, and for me simply applying
cordova platforms remove android
then
cordova platforms add android
used to fix it, but now not even that is working. The frustrating part is I have two projects on my same computer that I've been updating together and one builds while the other doesn't. So I can't blame the ANDROID_HOME or the like. When I say this I mean:
F:\XXX\XXX\XXX\myApp-2>Cordova build android
Works perfectly.
Any thoughts? Did I do something to ruin my project somehow? I'm sure both configs are similar but if someone can point me the right way I would be grateful. Thank you.
I had the same issue. I fixed it as follows:-
Open Android studio configuration.
Go to config>SDK Manager>Android SDK>SDK Tools and install Android SDK Build-Tools.
Check the ANDROID_HOME variable. I am on mac, so it points to "/Users/<user_name>/Library/Android/sdk/"
. If you are on other system you need to find out the correct path.
If not set correctly set it as follows:-
export ANDROID_HOME="/Users/<user_name>/Library/Android/sdk/"
Now build it again and it should work fine
If you have not installed android studio the path can be different and you need to find out the actual path. I would recommend installing Android Studio as it makes things lot easier.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With