Next lesson playing in 5 seconds

Cancel
  • Overview
  • Transcript

2.3 Installing Cordova

Hello everyone, this is Reggie Dawson, welcome to the Building an App with Cordova course for tuts+. In this video we are going to install Cordova, we could download Cordova from Cordova.apache.org but it is recommended to use the command line interface with Cordova. Now, before we start, I wanna let you know that you will need to have the proper SDK installed to target a specific platform. For example, if we were going to develop and build an iOS app, we would need to have a Mac to install the tools needed to develop for iOS. Android development tools will run on any platform, and Windows development tools will only run on Windows. The work flow we will be using for this course will be for an Android app. Even though we are building for Android, the steps will be the same as if you are building for an iOS app. Another thing to bear in mind, is that the phone gap build service will let you build your app for any platform you like, regardless of what kind of environment you develop the app in. We can use this service to get around the requirements of the individual SDKs and truly develop for any platform. Now installing the various SDK's is easy with the exemption of the Android Development Tools on Windows. In order to add the Android platform when building our app we need these tools. The first thing we need to do is install the Java Development Kit, which presently at version 8. I've included the download link in the course notes. We will download for our platform, which in this case is 64-bit Windows. Then we're going to install the JDK in the default location. After installing, make sure you know the location your JDK was installed to. In my case, mine was installed inside of Program Files inside of the Java folder. After installing right click on computer and choose properties. From there go to advanced system settings, and in the advanced tab in the system properties click on the environment variables. We will add a new system variable with the name of java_home. The value of this variable will be the path to the JDK we just installed. Next we're going to download the Android SDK. I have included a link in the course notes. Since we won't be using the full Android studio, we just want to download the stand along Android SDK tools. We can choose a zip of the files, or an installer for Windows. I will choose the Windows installer and download. After we download the SDK, install it and take note of where it is located. For example, in Program Files. After that, we need to add references to the path environment variable for the Android tools. Again, right-click on Computer and choose Properties. From there, go back to Advanced system settings and again in the Advanced tab of the System Properties, click on the Environment Variables. Highlight the path variable and click Edit. Add a semicolon first. And then add this path that corresponds to where we installed the Android SDK. I've added a semicolon already because we have one more reference to add. If you install the Android SDK in the default location like I did your path should correspond to mine. If not enter the appropriate paths for where you installed the Android SDK. After that, go to command prompt and type android. If you configured everything correctly, the Android SDK Manager should launch. This allows us add to various versions of the Android platform to use. We're going to make sure to choose the newest Android SDK Build Tools, in this case version 23.0.1 which is already selected. Also already selected is Android 6.0 (API 23), which is the latest version of Android available to us. If we want to support older versions of Android, we can install older versions. And then under extras, we wanna install the Android Support Repository. After we have our packages selected, click install packages button. Bear in mind the install will take awhile. I just sped it up for the sake of this video as I didn't want you to sit here ten minutes while I installed the SDK. Finally, we need to install two more programs. First we need to go to git-scm.com and download and install Git Tools for Windows. Then we need to go to nodejs.org/en to download and install Node.js for Windows. After we have gitNode installed, we can go to the command prompt to install Cordova. After everything we had to do to get the Android development kit set up, the Cordova install is simple. To install Cordova type npm install -g cordova. Cordova has recently switched over to using node and as a result, Cordova's available through npm. Npm for those that don't know is a package manager node that a lot of software is distributed through. The npm command we just ran installed the Cordova command line interface globally. After that we are ready to use Cordova. We can also install the PhoneGap command line interface in the same way if we choose. Remember that the two platforms are interchangeable. Even though PhoneGap typically lags behind Cordova in terms of features, the PhoneGap command line interface has commands for PhoneGap build. This allows you to use the build service through the command line interface. To install phonegap we run. Npm install -g phonegap. We should now have our development environment set up and ready to go. In the next video we will learn to use the command line interface.

Back to the top