Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error in building android app using apache cordova

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 ?

like image 631
Nasser Mansouri Avatar asked May 18 '15 13:05

Nasser Mansouri


People also ask

What are the prerequisites for Cordova build?

To develop Cordova applications with MobileFirst features, you must have the Apache Cordova command-line interface installed. You must have version 6.1. 1. You might want to use other development tools that support Apache Cordova as part of your development environment.

Is Apache Cordova discontinued?

Calls from the Cordova SDK are calculated at less than 1 % of VS App Center's service; hence App Center announced the withdrawal of support for Apache Cordova: The option to develop Apache Cordova apps using the portal, CLI, or API had already been abolished by App Center.

How to create your first app in Cordova?

Create your first Cordova app 1 Installing the Cordova CLI. The Cordova command-line tool is distributed as an npm package. ... 2 Install pre-requisites for building. To build and run apps, you need to install SDKs for each platform you wish to target. ... 3 Using merges to Customize Each Platform. ... 4 Updating Cordova and Your Project. ...

What does the Cordova create script generate?

By default, the cordova create script generates a skeletal web-based application whose home page is the project's www/index.html file. All subsequent commands need to be run within the project's directory, or any subdirectories:

How to find the latest version of Cordova?

For example, an app can incorporate a back button graphic into the iOS interface, stored in merges/ios/img/back_button.png, while the Android version can instead capture backbutton events from the corresponding hardware button. Run cordova -v to see which version is currently running. To find the latest released cordova version, you can run:

How do I find plug-ins in Cordova?

Plugins are typically hosted on npm and you can search for them on the plugin search page. Some key APIs are provided by the Apache Cordova open source project and these are referred to as Core Plugin APIs. You can also use the CLI to launch the search page:


2 Answers

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.

like image 187
QuickFix Avatar answered Oct 24 '22 00:10

QuickFix


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! :)

like image 30
Mayra Rodriguez Avatar answered Oct 23 '22 23:10

Mayra Rodriguez