8
votes

i have installed cordova on linux mint 17.1 xfce, jdk and android and npm is ok and i can create new cordova application and add android platform to it :

cordova create ... cordova platform add android ..

but when i want to build android i get a error : cordova build ...

Running command: /home/nasser/Desktop/app/app01/platforms/android/cordova/build 
ANDROID_HOME=/home/nasser/android/sdk
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386
Running: /home/nasser/Desktop/app/app01/platforms/android/gradlew cdvBuildDebug -b /home/nasser/Desktop/app/app01/platforms/android/build.gradle -Dorg.gradle.daemon=true

FAILURE: Build failed with an exception.

* Where:
Script '/home/nasser/Desktop/app/app01/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.

* 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: 20.222 secs

/home/nasser/Desktop/app/app01/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: /home/nasser/Desktop/app/app01/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/nasser/Desktop/app/app01/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /home/nasser/Desktop/app/app01/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /home/nasser/Desktop/app/app01/platforms/android/cordova/build: Command failed with exit code 8
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Process.ChildProcess._handle.onexit (child_process.js:810:5)

what i can do ?

3
have you launched the android sdk manager to install the sdk tools and sdk platform? - QuickFix
no! i have downloaded ADT and extracted it, then downloaded last version of platform and extract/copy to platform directory, - Nasser Mansouri
Its Working for me check stackoverflow.com/questions/38660955/… - vinod
Its Working for me check stackoverflow.com/questions/38660955/… - vinod

3 Answers

4
votes

Once you installed the android sdk, configured ANDROID_HOME and updated the path, you have to run the androidcommand to actually download the sdk tools and android platform.

You don't need to download everything. You can uncheck the system images (keep one if you want to use the emulator), the samples, the sources of android, the docs and android apis older than API 22 (latest android cordova version 4 requires api 22).

Not sure if you still need to install ant with android cordova 4, as it seems they switched to graddle wich is installed automatically.

1
votes

I had the same problem, and this is the solution for the problem referent to:

No installed build tools found. Please install the Android build tools version 19.1.0 or higher.

1) You have to go to the android sdk tools folder, for example (in my case) I just wrote the command in my console: $ cd android-sdk-linux/tools

2) Inside this folder you have to write the command

$ ./android list sdk --all and after $ ./android update sdk -u -a -t 20

And that's all! :)

0
votes

This will install all the tools you need as well as the system images which are quite large, limit them using the --filter flag

android update sdk --no-ui --all