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:
- Android Studio
- Java JDK v1.7+ – Installation notes (Make sure its not the JDR, made this mistake)
- Apache Ant (for compiling)
- Some knowledge of copy/paste and how to read from images. If you’re blind what the hell are you doing developing for apps anyway)
Step 1 – Installing stuff
Download and Install Android Studio.
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.
Once installed you’ll just have a folder full of stuff.
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 (
sudo npm install -g phonegap
Download the latest version, this can be any format you want, I go with zip as it has the most support: http://tweedo.com/mirror/apache//ant/binaries/apache-ant-1.9.3-bin.zip
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.
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:
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:
Now scroll down the list and fun straight up
Now add the following to the end of the list:
- C:\PROGRAM FILES\JAVA\JDK1.7.0_45\BIN;
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
Verifying things worked
- Check Ant:
- Check Node:
- Check Java:
- Check Phonegap:
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:
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.