I had the same error when I tried to build an app. I was probably using unity 2017.2.1f1. And I resolved the issue by changing the tools in the sdk folder with the tools_r25.2.5 - To do that i simply download this file online here - https://androidsdkoffline.blogspot.in/p/android-sdk-tools.html
At first just rename the tools folder already present in sdk root folder with toolsXYZ and then Unziped tools_r25.2.5 and after that copied its tools into the sdk root folder.
Still, my error was present then I thought my jdk version is not correct. So downloaded the correct jdk1.8 from here - http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Downloaded java kit 8u161 and then in Edit->Preferences ->External Tools Set these jdk1.8 path and sdk paths.
It worked for me after that and I built my first app using Unity 3d
I hope it works for you too.