Installing PhoneGap and Android Studio on Windows - simnova/webdevdocs GitHub Wiki
Please follow the installation order as it appears.
- If you encounter issues when editing your path variables, please see this stack overflow post for some good advise as how to prevent this issue.
- Download JDK- Java SE Development Kit - Windows x64 - (latest edition) and Install using default options
- Add a system variable JAVA_HOME and point it to the directory containing the contents of the JDK (example C:\Program Files\Java\jdk1.7.0_51)
- Add ;%JAVA_HOME%\bin; to the Path system variable.
- If you have a Proxy Server, note proxy server settings and:
- Start --> Type Java Control Panel
- General Tab --> Click Network Settings...
- Choose the appropriate settings, "use browser settings" may work for you.
- Validate Java Install:
- From a command prompt enter the following
java -version
- You should see something like :
java version "1.7.0_51"
- From a command prompt enter the following
- Download Apache Ant and extract to a directory on your computer. (example C:\util\ant\)
- Add a system variable ANT_HOME and point it to the directory containing the contents of the ANT directory
- Add ;%ANT_HOME%\bin; to the Path system variable.
- Validate Ant Install:
- From a command prompt enter the following
ant -version
- You should see something like :
Apache Ant(TM) version 1.9.3 compiled on December 23 2013
- Troubleshooting: Unable to locate tools.jar (check to see if JAVA_HOME is set properly)
- From a command prompt enter the following
- Download Android Studio and Install using default settings.
- If you have a Proxy Server, note proxy server settings and open Android Studio:
- File --> Settings --> (IDE Settings Section) --> HTTP Proxy
- Make the appropriate selection for your environment.
- Add a system variable ANDROID_HOME and point it to the directory containing the android sdk that's installed with Android Studio (example: C:\Users\jdoe\AppData\Local\Android\android-studio\sdk)
- Add the following to your Path system variable:
- ;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;
- If you have a Proxy Server, note proxy server settings and open Android Studio:
- Download Node and Install (if you already have it installed, download and install again to update it)
- Clear your NPM cache (this may save some headaches):
npm cache clean
- If behind a firewall, configure node to speak to the firewall by issuing the following commands:
npm config set proxy http://domain%5Cusername:password@ipaddress:port
npm config set https-proxy http://domain%5Cusername:password@ipaddress:port
- Validate Node Install:
- From a command prompt enter the following
node --version
- You should see something like :
v0.10.26
- From a command prompt enter the following
- Update Node & Global Packages
- Update Node:
npm update -g n
- Update Global Packages:
npm update -g
- Update Node:
- Clear your NPM cache (this may save some headaches):
- Install Cordova
npm install -g cordova
- Install Plugman
npm install -g plugman
- If behind a firewall, configure plugman to speak to the firewall by issuing the following commands:
plugman config set proxy http://domain%5Cusername:password@ipaddress:port
plugman config set https-proxy http://domain%5Cusername:password@ipaddress:port
- If behind a firewall, configure plugman to speak to the firewall by issuing the following commands:
- In a command prompt, Navigate to a folder that will hold the project (example: C:\MobileApps)
- Create a new project:
cordova create MyFirstMobileApp com.companyName.MyFirstMobileApp MyFirstMobileApp
- Navigate to the new project folder:
cd MyFirstMobileApp
- Add the Android Platform:
cordova platform add android
- Bring up android config:
android
- In the packages tree, in the open Android x.x.x (APIxx) ...
- Select Intel x86 Atom System Image
- In the packages tree, in Extras..
- Select Intel x86 Emulator Accelerator (HAXM)
- Click the Install Packages button
- Agree to any dialogs that come up.
- While still in the android config, note the SDK Path, open windows explorer and navigate to that directory.
- Navigate to extras\intel\Hardware_Accelerated_Execution_Manager and run IntelHaxm.exe
- While still in the android config, choose tools->manage avds, switch to Device Definitions, select one, Click Create AVD, be sure to choose Intel Atom(x86) for CPU/ABI and in emulation options enable Use Host GPU, choose ok and close out..
- When pulling from source control, make sure all files are not read only and run clean.bat in platforms\android\cordova and delete any local.properties files in any directories..this may help relieve headaches!!!
- Choose to debug using an emulator or on a device attached to the computer:
- Start and deploy to the android emulator:
cordova emulate android
- Debug using attached android device:
cordova run android
- Start and deploy to the android emulator:
- See cordova android debug output:
adb start server
adb devices
adb logcat CordovaLog:D *:S
- You can use Google Chrome Development tools to remotely inspect and debug javascript running on the device (KitKat +) or in the emulator. This is just wonderful!
- Update the java code to enable remote debugging
- Start the ADB server:
adb start-server
- Open a new chrome window, enter the following url into the addres bar:
chrome://inspect#devices
- I'm feeling lazy, this page has most of the steps. Just start with the "Welcome to Android Studio" screen shot and look at the screenshots, just choose the defaults if there's a mismatch, and you'll be good to go.