Reputation: 83
I recently installed cordova and recent version of android sdk(24.1.2),and Because of Iran sanctions! I can't download android build tools with Android SDK Manager.therefore I downloaded it(v.22) as a zip file and extracted it to "android-tools" directory in my "android-sdk" directory.but cordova can't find it and when I build the app,it gives me this error message:
FAILURE: Build failed with an exception.
* Where:
Script 'D:\hello\platforms\android\CordovaLib\cordova.gradle' line: 64
* What went wrong:
A problem occurred evaluating root project 'android'.
> No installed build tools found. Please install the Android build tools version
19.1.0 or higher.
p.n:I have added "tools" and "platform-tools" directories path to System Variables.
I have downloaded sdk build tools r.20
but have same problem. and an another weird thing is that Android SDK Manager
has problem with renderscript
and lib
directories that are in build-tools
directory, as showed in pic:
I solved it :) I created a folder with name 22
into build-tools
folder and copied all files into it and it works.
Upvotes: 3
Views: 3688
Reputation: 147
What I realized is that I'd installed a latest RC revision of build tools - 23 rc3 (in Tools (Preview Channel) visible in the SDK GUI) and perhaps the cordova.gradle build script wasn't accepting it because of the way its REGEX is written/created. The folder was named 23.0.0_rc3 in the $(SDK)\build-tools directory and the function for finding build-tools was most probably ignoring it. Here is the function from cordova.gradle:
String[] getAvailableBuildTools() {
def buildToolsDir = new File(getAndroidSdkDir(), "build-tools")
buildToolsDir.list()
.findAll { it ==~ /[0-9.]+/ }
.sort { a, b -> compareVersions(b, a) }
}
When I installed a non-RC revision of build tools, it just worked fine.
Upvotes: 3