Set up system for Android development for Mac

Keyboard Shortcuts

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.

- [Voiceover] To use the CLI to buildAndroid based mobile applications,we're going to need to install the Android SDK.But before we do that, we need to make surethat 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 seeit's available for a variety of platforms.We're on a MAC, so I will first acceptthe license agreement, select the MAC versionand let the download start.

And after a few moments, we will now openthe 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 turnto 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 turnour 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 installthe full Android stuido, so this would be an optionif 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 pageand 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 hereat 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 needto tell our command line where these tools live.To do that, we're gonna actually use a text editorto 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 andcdup 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 hereso 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 nameandroid-sdk-macoxx.That's what the unloaded zip file.If you change that zip file name, you wanna make sureyou change the directory path here.Next, we export back into the bash profile path variablethe location of both the platform toolsand the tools directory within the Android SDK.

We need to know the location of boththese elements for everything to work.And with that, we can just save this file.The next step we actually have to do with the Androidstuff, is we actually have to download the variousSDK components for Android itself.We can do that a couple ways.We can actually from the command line justtype 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 thatour 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 itto reload your bash file or issue a source commandon the .bash file to have a force reload.So here we have various tools, I'm actually goingto select a large collection here.I'm not going to worry about the previewchannel, that's the new stuff coming.

So we'll turn that off.And then for each of the API's wewant 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 nowbegin downloading all these packages for us.Now, this is gonna take a while, so we'll cut awaythrough the magic of video and come back in just a moment.And with that, all of our Android SDK's and othersupporting 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 partof our installation to work with the Cordova CLI.

Resume Transcript Auto-Scroll

Author

Released

6/24/2016

Apache Cordova is the open-source version of PhoneGap, the leading tool for cross-platform app development. It's a write-once, run-anywhere solution specifically designed for mobile. But to ensure a smooth cross-platform workflow, it helps to know some setup and configuration basics. In this course, Chris Griffith introduces Apache Cordova and the PhoneGap ecosystem, including the two command-line interface (CLI) tools and the PhoneGap desktop app. He shows how to set up your local system and how to create, configure, and build your first project with the Cordova CLI. Once you've mastered the fundamentals, Chris shows how to extend your app with native and third-party plugins that enable features such as QR code detection and geolocation, and debug your app, preview it in an emulator or on an actual device, and then prep it for release in the Apple Store or on Google Play.

Topics include:

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