devwannabe
devwannabe

Reputation: 3210

Cordova/Phonegap confusion

I'm new to both tools. I'm trying to get a sample application working, a flashlight app that I saw on github. I'm using OSX. I've created a project and added the platform too, android. However, I'm not sure how to start the application.

I was reading this stackoverflow post and the guy mentions that android sdk and platform tools are needed, Phonegap/cordova add Android Platform on Mac not recognized as core cordova platform Where can I find those?

Since I was curious, I ran phonegap run android and below is what I got then it went back to the prompt. Nothing happened.

[phonegap] executing 'cordova run android'...
[phonegap] completed 'cordova run android'

Fyi, this is what is in my directory right now

drwxr-xr-x  3 user01  207825898  102 Dec 23 12:15 hooks/
drwxr-xr-x  6 user01  207825898  204 Dec 23 12:19 www/
-rw-r--r--  1 user01  207825898  992 Dec 23 12:32 config.xml
drwxr-xr-x  6 user01  207825898  204 Dec 23 12:32 plugins/
drwxr-xr-x  4 user01  207825898  136 Dec 23 12:32 platforms/

And this is my unix history output

$ cordova create .
$ ls -lrt
$ cordova plugin add https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin
$ cordova platform add android

Then I ran this

$ cordova build

However, I got an error

Running command: /Users/user01/repos/Flash/platforms/android/cordova/build
[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 building one of the platforms: Error: /Users/user01/repos/Flash/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /Users/user01/repos/Flash/platforms/android/cordova/build: Command failed with exit code 2

What am I missing? I watched a tutorial in youtube and the person used Eclipse. Do I really need an Eclipse editor to be able to start a phonegap application? I was hoping I can just copy the build directory into an Apache server then visit the webserver from a phone. However, I'm not sure if I do it this way, I'm missing the purpose of phonegap.

Upvotes: 0

Views: 118

Answers (1)

sschrass
sschrass

Reputation: 7156

Set ANDROID_HOME system variable to the location of your Android sdk. Also add the bin folder of your Android sdk to the system variable path.

Cordova looks for the Android sdk and binaries by evaluating those two variables.

Upvotes: 1

Related Questions