Android SDK tutorial for beginners

print
android-studio-2-banner

Android is the world’s most used mobile operating system, so it is essential that there is an easy way to develop apps for it.  This is where the Android SDK comes in. The SDK, which now comes as part of Android Studio and includes sample code and the emulator, makes it easier than ever to develop for Android. So, let’s get started.

What is the Android SDK?

SDK Manager

The Android SDK is a software development kit that includes all the necessary libraries and files for developers to make apps for Android. The kit also includes sample code with working applications, and the Android Virtual Device Manager, which lets you test your app on any version of Android (or Android Wear) that you want.

medium_2495_HotJavaAndroidBundle_MF-MAIN_update1

Hot Java Android Coding Bundle

If you are serious about coding you should checkout our Android Coding bundle course with 60+ Hours of Training.
Get all 5 courses for just: $29  $657 [95% off]

GET THIS DEAL

There are different components that can be downloaded, including platform-tools and build-tools.

  • Platform-tools are used to support new and existing features of Android, including the Android Debugging Bridge, bmgr and logcat. The Android Debugging Bridge (ADB) can be used to see what is causing errors and what processes are running as well as other things. bmgr is a tool used to manage the backup manager on an Android device with an API level of 8 or higher. It can be accessed by using the ADB.
  • Build-tools are made to work with the Platform-tools but can be updated independently if needed. These include JOBB, ProGuard and zipalign. JOBB allows you to build encrypted and unencrypted APK expansions in OBB format. ProGuard is able to shrink and secure your app by removing unused items, renaming classes and the like, this makes it harder for people to reverse-engineer your app and it makes the overall size smaller which is also a bonus. Zipalign optimizes .apk files to start in a certain alignment relative to the start of a file.
  • The SDK-tools are required and are used no matter what version of Android you develop for, these include: build-tools, debugging-tools and image-tools along with others.
  • The Android Debugging Bridge (ADB) and fastboot are also included in case you ever need to get your device out of a jam as well. Fastboot can be used to flash or wipe partitions to your device in case something happens, this is very easy to do. The ADB can be used to troubleshoot issues with your device and apps.

What makes the SDK special is that everything you could ever need or want is just a few clicks away, and with Google’s excellent developer page, anything is possible. Updating is a breeze too, if an update is available, the SDK will let you know when you launch the SDK Manager. This is a helpful way to make sure everything is up to date as well as check to see if there are any previews to download and mess around with.

How to use the samples provided

Google provides some very helpful samples, if used correctly. Samples can be found in the SDK folder under “samples” then under the Android version you want to take the sample from. Android Wear samples have an extra subfolder known as “wearable”. In these samples Google provides basic outlines for how the user interface should look for that version of Android and other new API changes.

When the watch face API came out, Google added a great example on how to use a classic ticking second hand watch face and a mechanical watch imitating sweeping second hand watch face. You can learn a lot by using the samples and the official documentation that Google provides. You can run the examples using the AVD Manager and modify the code however you like before using the same techniques in your own app.

The samples covers areas such as connectivity, including basic networking and Bluetooth; gestures, including gesture detection and multi-touch; and the user interface, including ActionBars, Notifications, transitions, swiping and Immersive mode.

What is the AVD Manager and how to use it

AVD Madness

The Android Virtual Device Manager is a very special entity when it comes to developing apps and the Android SDK. The AVD Manager lets you create virtual Android and Android Wear devices that you can run your apps on. These virtual devices are stripped down versions of Android that can be configured to any screen size, resolution and even type of processor including ARM, MIPS and x86.

Google and Intel have made it a lot easier to run an AVD by using Intel’s Hardware Accelerated Execution Manager (HAXM) which enables the AVD to run in “Fast virt mode”. This makes for a very smooth virtual environment rivaling an actual Android device. The only downside is that there is no official way for two AVDs to communicate with each other. For example, you can’t have an Android phone connect with an Android Wear device if both are AVDs. However, you can connect your real device to an AVD wear device.

How the SDK and Android Studio tie together

Android Studio is in a league its own, and getting to know its ins and outs is a must, Gary Sims explains how to writing your first Android app using Android Studio. Android Studio makes accessing the SDK and AVD Manager a breeze. The icons to access both are located on the top middle toolbar. Having the Android SDK integrated into Android Studio is a huge plus when it comes to productivity. For example, the Android Debugging Bridge works beautifully with Android Studio and the AVD Manager. If you were to create a Android Wear app that requires the connection of a phone for data you could connect your phone and start an AVD of a wear device, connect the two and see exactly what is happening on each simultaneously. This is something that you will find hard to live without after you have used it a few times.

Android Developer Newsletter

Do you want to know more? Subscribe to our Android Developer Newsletter. Just type in your email address below to get all the top developer news, tips & links once a week in your inbox:

PS. No spam, ever. Your email address will only ever be used for Android Dev Weekly.

Wrap-up

The Android SDK is a very powerful tool for creating simple apps to complex games. The SDK, AVD Manager and Android Studio work wonderfully together. Using the samples and documentation provided by Google anything is possible. It has never been easier to develop for Android. So why not start? You can pick up the Android SDK here.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.