I know it was discussed many time but seems like I have stuck. I had decided to try Cordova and Phonegap for my small self-education application but did not success to run any "hello world" application at all. During my experiments I used these articles. I would say both of are very valuable. Many thank to authors:
I use Ubuntu as my development operation system. I have installed Android SDK and configured all environment variables according to specification. So I am able to run Manager:
I have created new project called "my-app". When I try to run cordova run android
I get this error:
shell.js: internal error
Error: EPERM, operation not permitted '/home/jhon/workspace/my-app/platforms/android/res/xml/config.xml'
at Object.fs.chmodSync (fs.js:826:18)
at Object.chmodSync (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:208:17)
at copyFileSync (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/src/cp.js:41:6)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/src/cp.js:198:5
at Array.forEach (native)
at Object._cp (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/src/cp.js:157:11)
at Object.cp (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/src/common.js:186:23)
at PlatformApiPoly.prepare (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/platforms/PlatformApiPoly.js:188:15)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:95:28
at Array.map (native)
Okay you have no permissions. Lets try it with sudo:
$ sudo cordova run android
Running command: /home/jhon/workspace/my-app/platforms/android/cordova/run
ERROR: Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
ERROR running one or more of the platforms: Error: /home/jhon/workspace/my-app/platforms/android/cordova/run: Command failed with exit code 2
You may not have the required environment or OS to run this project
What ?! Not able to recognize ANDROID_HOME
? Lets check it:
$ source ~/.profile
$ echo $ANDROID_HOME
$ /usr/local/android-sdk-linux
$ source ~/.bashrc
$ echo $ANDROID_HOME
$ /usr/local/android-sdk-linux
So what I am doing wrong ? Many thanks.