Using android studio to compile phonegap apps in cmd setup – Windows

I am just writing down the shit here so that when I move to a new pc I can just copy and paste the detts.

Things we’ll need:

Step 1 – Installing stuff

Android Studio

Download and Install Android Studio.

Step Android 1

The location is up to you, but I find it easiest to put it at the root of my C drive. I conveniently created a folder amply called “phonedev” folder.


Step Android 2

Once installed you’ll just have a folder full of stuff.

Java JDK

I’ve already got this installed so can’t take print screens for myself.

But good, its installed.


Bog standard install please.


With node.js installed we can now install phonegap. From cmd (start->run->cmd) sudo npm install -g phonegap

Apache Ant

Download the latest version, this can be any format you want, I go with zip as it has the most support:

step ant 1

Extract that to the phonedev folder you created eariler, it should like this once extracted: C:\phonedev\apache-ant-1.9.3 and for now you’re done.

step ant 2


System Variables

Now is the fun part:

bring up the advanced system variables. Easiest way is hitting Windows Key+Pause on your keyboard. This will just bring up the Control Panel -> System From there you want to click the Advanced system settings:

system settings

Then click Envrionment Variables This little guy is where we tell the computer where the hell we installed anything.



Adding new variables

You need to add two new variables, to do this click New under the System variables section. Thats the second new tab in this little window.

Now add these two:

  • ‘ANDROID_HOME’:’C:\phonedev\sdk’
  • ‘ANT_HOME’:’C:\APACHE-ANT-1.9.3′

new ones


Now scroll down the list and fun straight up Path

Now add the following to the end of the list:


or if its more simple just paste this in at the end.

Worth noting that before pasting this in, make sure the last variable in the last already has a ; Otherwise it’ll just break things.

Before Pasting… Notice the trailing ;

before pasting

After Pasting

after paste

 Verifying things worked

  • Check Ant: ant -version
  • Check Node: node -v
  • Check Java: java -version
  • Check Phonegap: phonegap -version

If all went well all of the above will look like this:



At last the best bit, check everything is working.

Phonegap create helloworld

Now move into that folder:

cd ./helloworld
phonegap build android

Now cream everywhere!!

Although there is actually a lot more you should know, but as i’m just doing it for reference when my PC next crashes, maybe if somebody ask’s I’ll do it.

Leave a Reply

Your email address will not be published. Required fields are marked *