Android for .NET Developers: Setting Up Your Environment

jim-wilson-v5

Welcome to Part 2 of this review of the Pluralsight course Android for .NET Developers: 1 Getting Started by Jim Wilson

Jim has over 30 years of software engineering experience, with the past 15 years heavily focused on creating mobile device and location-based solutions. He has co-founded multiple software-related startups and has served in a consulting role at several more.

After nearly a decade as a Microsoft Device Application Development MVP, Jim now focuses on developing Android and iOS device applications. Jim’s passion is mentoring software developers. He blogs at hedgehogjim.wordpress.com.

Also in this series:
Part 1 – Series Overview
Part 2 – Setting up your environment
Part 3 – Android Toolset Fundamentals
Part 4 – Dalvik Debug Monitor Server
Part 5 – Understanding Android Projects
Part 6 – Android Studio
Part 7 – Understanding Android Versioning

Setting Up Your Environment

What do we need

This part of the course was produced before Android Studio was released.
Jim added a module about Android Studio will be reviewed soon.

To learn about Android Studio in depth see Exploring Android Studio

In this lesson Jim recommends the Android Developer Tools (ADT) Bundle.
This has the Eclipse Integrated Dev Environment, ADT Plugin, Android SDK Tools and Android Platform Tools.

We also need the Java Development Kit (JDK).

Jim warns that it’s very important to check which version of the JDK is required by the Android SDK.

Walkthrough: Installing ADT Bundle and JDK

Jim demonstrates the installation. He says developer.android.com is effectively MSDN for Android.

The ADT Bundle is no longer available on its own so I recommend downloading Android Studio instead.

You will need to download the JDK as well. Jim shows how to do this. You’ll probably want JDK 8 but check the system requirements first.

Android Virtual Devices/Emulators

AVDs are essentially emulators. They allow you to test apps on your desktop.

Jim explains the AVD Definition, which is a description of what a device would look like.

We can create an AVD image from a definition. We can make modifications to definition characteristics. And we can create many instances of an image from the same definition.

There are certain scenarios that only work well on hardware devices, but the emulator images come in handy for answering questions like “what would this look like at that resolution?”

Jim explains the Android Virtual Device Manager, which allows you to create and access AVDs.

We see a screenshot of the “Create new Android Virtual Device (AVD)” modal dialog box and Jim explains the key options here.

Walkthrough: Creating an AVD

Jim demonstrates how to create an AVD from the ADT. This is very similar to how it works in Android Studio so this advice is still good.

He creates a new Android application called “MyFirstAndroidApp”. He clicks the bug icon to debug the program using the emulator.

We see a Hello World application running in the emulator.

Debugging using a real device

Jim warns that AVDs are not enough. Debugging using a real device must be part of your testing.

He says debugging on a real device requires some extra setup: enabling USB debugging and installing USB drivers on your desktop computer

Enable USB debugging on a device

Jim says there is an inconsistency in how debugging is enabled. The location of the USB debugging checkbox depends on which version of Android you are using. He explains some common locations.

Most probably you’ll be using Android 4.2 or newer. This involves tapping the Build number 7 times to “become a developer” and unlock the developer options.

Install USB drivers on your desktop

Jim explains the different kinds of USB drivers. Most Android Developer Phones use the Google USB Driver. The Galaxy Nexus relies on a Samsung provided driver.

Walkthrough: Downloading Google USB Driver

Jim shows how to do this using the Android SDK Manager. We see the Google USB drivers are downloaded to \sdk\extras\google\usb_driver\
You may need to download a driver from the manufacturer of your Android device.

Special considerations for Android 4.2.2 and newer

Security requirements were increased in Android 4.2.2. You need to confirm that USB debugging is allowed on the device.
Generally you’ll just check “Always allow from this computer” and click OK.

Stay awake

We see the sleepy cat photos in this lesson. Just like a cat, you can wake up your Android device but if you leave it alone it will go back to sleep.

On most devices in the Developer options there’s a Stay awake checkbox. Jim explains there’s also a Stay Awake app that is useful.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s