In order to build Android based applications with Apache Cordova, the Android SDK and tools need to be installed. Chris Griffith shows you the options you have for installing the SDK or Android Studio. He also shows what additional steps are needed.
- View Offline
- [Voiceover] To use the CLI to build Android based mobile applications, we're going to need to install the Android SDK. But before we do that, we need to make sure that we have Java installed on our machine, as well. We can install it here, from oracle.com, and it's along the web address. We're looking to install the Java SE Development Kit 8. So if we scroll down, we'll see it's available for a variety of platforms. We're on a MAC, so I will first accept the license agreement, select the MAC version and let the download start.
And after a few moments, we will now open the installer and install Java on our platform. And now the file's downloaded, we'll go ahead and keep it. Let's go ahead and just open it. Hide Chrome for a moment. Double click the installer. And work through the dialogues. Great, now we have Java installed, now we can turn to the next part of the process.
Close this. And quickly clear out our downloads folder. We'll return back over to Chrome and onto the next part. So, with Java successfully installed, we can now turn our attention to actually installing the Android SDK. So, if we go to developer.android.com/sdk, we'll be able to download it. There are two options, one would be to install the full Android stuido, so this would be an option if you were actually doing a lot of native development, plug in development, or some further Android development.
You could use this full-fledged IDE. We actually don't need that option. We can actually scroll to the bottom of the page and actually just get the command line tools. So here, they're available for Windows, MAC OSX and Linux. Let's go ahead and get the OSX version, standard terms and conditions. Click, and the SDK will download in just a moment. So, that is over in our downloads folder, so let's go ahead and take a look at that.
Let me hide our Chrome here. So it's a zip file. On Windows, you actually get a nice little installer, but MAC people, we just get a zip file. I'm going to unzip that, place that on my desktop. Now, I have a development folder I like to keep my SDK's in. So that is actually just located right here at the top level under my user's directory. And I will just put that SDK right in there.
Now, for the CLI tools to work, we're going to need to tell our command line where these tools live. To do that, we're gonna actually use a text editor to modify our dot dash underscore profile file. So, lemme pull up the terminal. Go ahead and make this nice and big so you can see it. Great, now, I'm just gonna go ahead and cd up to the top level and I've already created a bash file, but if you haven't, go ahead and type in touch.bash_profile, I'll just say open .bash_profile.
And this is gonna open my profile. Now, I've already set up the configuration here so you don't have to watch me type it in. But I've set up a few things here. I've set the Android home to my user's directory, Chris Griffith Development and the file name android-sdk-macoxx. That's what the unloaded zip file. If you change that zip file name, you wanna make sure you change the directory path here. Next, we export back into the bash profile path variable the location of both the platform tools and the tools directory within the Android SDK.
We need to know the location of both these elements for everything to work. And with that, we can just save this file. The next step we actually have to do with the Android stuff, is we actually have to download the various SDK components for Android itself. We can do that a couple ways. We can actually from the command line just type in Android, or if you're using Android Studio, it will walk you through the process, as well. Let's go ahead and just type Android.
And if this launches, that also let's us know that our bash profile is properly configured. If this does not launch correctly, that means your bash profile is not loaded correctly. You may need to close your terminal window and reopen it to reload your bash file or issue a source command on the .bash file to have a force reload. So here we have various tools, I'm actually going to select a large collection here. I'm not going to worry about the preview channel, that's the new stuff coming.
So we'll turn that off. And then for each of the API's we want to support, go ahead and just click. And then once we're done, we'll go ahead and click Install, accept the licenses, and the Android SDK manager will now begin downloading all these packages for us. Now, this is gonna take a while, so we'll cut away through the magic of video and come back in just a moment. And with that, all of our Android SDK's and other supporting tools have now been downloaded.
That took a while, so hopefully maybe you went out, and had a nice little walk or something, got some fresh air, I know I did. So, with that, we can close this down. And we should now be ready to continue on with our next part of our installation to work with the Cordova CLI.
- What is Apache Cordova?
- Setting up for Android or iOS development on Windows and Mac
- Installing the command-line interfaces (CLIs) for Cordova and PhoneGap
- Creating a Cordova project
- Adding and removing platforms from a project
- Working with metatags
- Configuring your app
- Building the app
- Extending an app with plugins
- Preparing for release
- Upgrading to PhoneGap desktop