3

I get this error, when i try to build and run an cordova project on an android device:

Running app on platform "android" via command "***/Documents/***/App/platforms/android/cordova/run" --device
[Error: An error occurred while running the android project.
/***/Documents/***App/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error executing "ant clean -f /***/Documents/***/App/platforms/android/build.xml": Build failed

Any suggestion on fixing this problem?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Mathias Dewelde
  • 665
  • 9
  • 19
  • Clean your project and try to build again. – Siddharth_Vyas Nov 25 '13 at 09:45
  • @Siddharth Vyas: Didn't fix it .. "Buildfile: /Volumes/Mac OS X II/Mathias/Documents/knockout-fest/App/platforms/android/build.xml -check-env: [checkenv] Android SDK Tools Revision 22.3.0 [checkenv] Installed at /Applications/Android/sdk -setup: [echo] Project Name: KnockoutFestival [gettype] Project Type: Application -pre-clean: clean: [getlibpath] Library dependencies: [getlibpath] No Libraries [subant] No sub-builds to iterate on BUILD SUCCESSFUL Total time: 1 second" But when i run cordova run afterwards i still get the same error as in my question. – Mathias Dewelde Nov 25 '13 at 09:51

2 Answers2

3

This happened to me when I upgraded the CLI cordova (via npm) to 3.3.1 but forgot up update my project to the corresponding version. This fixed it for me:

cordova platform update android
user3032911
  • 121
  • 5
  • thank you, that worked for me. In my case, I wanted to run a starter project downloaded from microsoft azure. – martinoss Mar 25 '14 at 18:01
2

Check if "adb devices" command works. If it doesn't work ensure "android-tools-adb" is installed and then run the "adb devices" command. Rerun the build after that.

Maniappan
  • 36
  • 2
  • Hey @Maniappan i have got http://stackoverflow.com/questions/20222461/build-error-running-cordova-platform-add-android error in win xp. Could you please tell me how can i resolve this problem. – Ashoka Mondal Dec 09 '13 at 11:41