Cordova cannot find android build tools on windows xp
I recently installed cordova and recent android android sdk (24.1.2), and due to Iran sanctions! I am unable to load Android Build Tools in Android SDK Manager. So I downloaded it (v.22) as a zip file and extracted it to the "android-tools" directory in my "android-sdk" directory. find it and when I build my 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.
pn: I added the path to the system variables to the "tools" and "platform-tools" directory.
I downloaded sdk build tools r.20
but have the same problem. and one more strange thing: Android SDK Manager
has problems with directories renderscript
and lib
that are in the directory build-tools
as shown in the pic:
Update
I solved it :) I created a folder named 22
in a folder build-tools
and copied all files into it and it works.
source to share
I realized that I had installed the latest RC build tools - 23 rc3 (in the Tools (Preview Channel) visible in the SDK GUI) and maybe the cordova.gradle build script was not 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 built-in tools search function was 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 an out-of-the-box version of the build tools, it just worked fine.
source to share