Develop Android Apps On Mac

If you are an iOS developer, having experience with Android can be a valuable addition to your portfolio of skills and experience.

This post walks through how to get started developing Android apps on your Mac. It will cover installation of the required tools, development of a first simple app, and running the app on the Android emulator.

Whereas native iOS developers must develop on a Mac, with Android, you have the choice of Windows, Mac, or Linux.

To get started with Android on a Mac, download Android Studio for Mac. Android Studio is the official IDE for Android app development, and is based on IntelliJ IDEA.

Once you download the DMG file, you should land at an installation page with instructions to install and launch, but the steps are as follows:

  1. Launch the Android Studio DMG file.
  2. Drag and drop Android Studio into the Applications folder, then launch Android Studio.
  3. Select whether you want to import previous Android Studio settings, and then click OK.
  4. The Android Studio Setup Wizard guides you though the rest of the setup, which includes downloading Android SDK components that are required for development.

The wizard summarizes the components that will be installed, as the screenshot illustrates.

Once the setup is complete, you will see the welcome screen.

You are now ready to start developing Android apps on your Mac, so let's create a first app.

Click the Start a new Android Studio project., and then you can configure the new project.

Name it FirstAndroidMac, and you can leave all other settings the same, or customize the Project location and Company domain. Click Next.

You will see the Target Android Devices screen, so leave the defaults as they are.

Click Next, and if this is your first project, you should see the Installing Request Components screen, and you can click Next when it is finished.

You'll see the Add an Activity to Mobile screen, where you are offered various Activity templates. An Activity represents something that a user can do, and generally has one window associated with it. One Activity may represent a Settings screen, and another might implement a payment screen.

An app has a main Activity, which is the entry point of an Android app. If you are an iOS developer just starting to look at Android, this is like UIViewController for an iOS app.

Select Empty Activity and click Next., which will lead to the Customize the Activity screen.

Leave the default values, including the MainActivity, and click Next. This will open the IDE.

Click on View > Tool Windows > Project, and then ensure Android is the selected view from the top drop down. You'll see the files that have been created for the project.

The MainActivity will be the first screen you will see upon launching the app. There is an activity_main.xml file which defines the user interface components for the screen. If you click on the xml file, you'll see that our empty activity has included a TextView that contains the ever so common "Hello World!".

Let's create an Android Virtual Device definition so that we can run the app on an emulator.

Select Tools > Android > AVD Manager. There should be one virtual device that exists by default in recent versions of the the Android Studio Virtual Device Manager. If for some reason there isn't one there, click Create Virtual Device... to create one.

Select a virtual device, and then under Actions, click the green play button to launch the emulator.

With the emulator now running, you can close the Virtual Device Manager if you like. Head back to your project in the IDE and click the green play button. You'll see the virtual device in the Select Deployment Target window.

Click OK to install and start the app on the virtual device. After the build and install has completed, bring the emulator window to the forefront and you'll see the app is now running. This will take some number of seconds.

You now have your first Android app running on a Mac!

Enter your text here...

Leave a Comment: