On Linux Mint 17.1 x86_64, Cordova v4.3.0 gives this error:
$ cordova run android
Running command: /home/naman/test/platforms/android/cordova/run
WARNING : No target specified, deploying to emulator
WARNING : no emulator specified, defaulting to Sample
Waiting for emulator...
Booting up emulator (this may take a while)....BOOT COMPLETE
/home/naman/test/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error: ENOENT, no such file or directory '/opt/software/android-sdk/tools/tools/lib/build.template'
at Object.fs.openSync (fs.js:432:18)
at Object.fs.readFileSync (fs.js:286:15)
at /home/naman/test/platforms/android/cordova/lib/build.js:129:40
at _fulfilled (/home/naman/test/platforms/android/cordova/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/home/naman/test/platforms/android/cordova/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/home/naman/test/platforms/android/cordova/node_modules/q/q.js:760:13)
at /home/naman/test/platforms/android/cordova/node_modules/q/q.js:574:44
at flush (/home/naman/test/platforms/android/cordova/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
ERROR running one or more of the platforms: Error: /home/naman/test/platforms/android/cordova/run: Command failed with exit code 8
You may not have the required environment or OS to run this project
PATH variable seems to be alright (the path for SDK is correct):
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/software/android-sdk/tools:/opt/software/android-sdk/platform-tools
I installed it using :
sudo apt-add-repository ppa:cordova-ubuntu/ppa
sudo apt-get update
sudo apt-get install cordova-cli
npm install -g cordova
The installation went smoothly and the project was created without any error. Am I missing some dependency?
You may need to uninstall the existing app on your device.
I installed my app on that device from another computer. When I run cordova run android
I get
You may not have the required environment or OS to run this project
.
But when I try to install my apk by adb
it told my that the app was already installed. So I uninstalled it an it worked.
For others having this problem, assuming you have already checked and fixed any environment variables using @Naman Dixit's answer, you may also have to remove and add your platforms:
cmd: cordova platform rm [platform(s) of interest]
delete everything in the [yourproject]/platforms folder. Then:
cmd: cordova platform add [platform(s) of interest]
that was the final step I needed to get everything to work
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With