While the iOS platform promises greater revenue-earning potential for app developers, Google’s Android has the overwhelmingly dominant position in terms of market share. A recent report from App Annie shows that the percentage of Android app downloads touched 90% in the third quarter of 2015. This spurt has been primarily due to the increasing availability of ‘budget Android phones’ – ensuring that practically everybody can own a handset and use applications on it. The growth of the smartphone market has pushed matters on too (for instance, the Chinese market has helped iOS in a big way as well). Many mobile app companies train their developers to start working on the Android platform first – before trying their hand at making iOS apps. We have here outlined the main steps involved in Android app development:
- Manage system requirements – For working with the Android Studio IDE on a Mac system, you need to be on the 10.8.5 Mavericks OS or higher. Make sure that there is at least 1GB of storage space available for installing the Android SDK. You will also need Java Runtime Environment 6 and Java Development Kit 7. If you are using an Windows system, upgrade to Windows 7 or 8 (making Android apps is possible on Windows Vista too, but hardly anyone uses that one!). The space requirement for Android SDK is the same, and the minimum display resolution level is 1280×800.
- Check the JDK – It is worth double-checking for the presence of Java Development Kit (JDK) on your system, before getting down to the actual development process. According to leading Android app developers, errors and bugs can crop up – if older, incorrect versions of JDK are installed. Simply type the commands ‘which java’ and ‘java-version’, and see the result displayed. In case JDK is missing from your system, visit the Oracle website and download the latest version.
Note: Mac systems generally come pre-installed with JDK.
3. Working with Eclipse – Instead of working with Android Studio, you can opt to work with the Eclipse IDE as well. Ideally, get a thorough idea of both the IDEs, and then take a call on which one you would like to code in. Download the Eclipse 3.5 Galileo package and install the latest Android Development Toolkit plugin. For a detailed Android Studio vs Eclipse comparison, click here.
4. Starting a new project – Okay then, you have Eclipse/Android Studio, you have the SDK…and now it’s time to start with the app development. If you are on the Android Studio IDE, click on File → New Project → Configure your New Project, from the ‘Welcome’ screen. Fill up the ‘Company Domain’, ‘Application Name’ and ‘Package Name’ fields correctly. On Eclipse, start the new project by File → New → Other → Android → Android Application Project.
Note: For making native Android apps, many developers use the Xamarin.Android tool as well.
5. Choose the SDK version – This one is tricky business. Android updates are notorious for their extreme fragmentation (one of the main reasons for the low adoption rates of the latest versions – simply because people do not get the update simultaneously, unlike iOS). In the ‘Min SDK Version’, specify the oldest Android platform version that your app will be compatible with. Do not select a version older than Android Froyo (API 8). By the same token do not select Android 5.0 Lollipop or 6.0 Marshmallow. The user-base of your application will become very limited in such cases.
6. Use the build systems – In Eclipse, Android app developers have the ‘Ant System’, while Android Studio has Google’s own ‘Android Build System’. With either of the two, several things can be done – right from generating a wide range of APKs with the same resources, to configuration and extension of the overall build process. Code reusability – a vital aspect of mobile app development – is also facilitated by the build systems of the IDEs.
7. Get familiar with the views and the project structure – Next up, you need to learn the project hierarchy and the different views (available in Android Studio). ‘Res’ and ‘Src’ are the folders in Eclipse where the XML layouts/images and the source codes (program lines) are stored respectively. There is an ‘Assets’ folder as well, and if you keep files there – you have to reference them by giving the full path ID. On the other hand, Android Studio offers several alternative Views of the project to developers (Project view, Android view, Tests view, Packages view, Production view, Project Files view, Problems view and Scratches view). Each of the views has its own features. Check out all of them to get a proper understanding of how your app is shaping up.
8. What is the Package Name all about? – Let’s here pause for a bit and explain what the Package Name (that you had filled up earlier) is all about. Any Android app development expert worth his/her salt will tell you that tracking the updates on your app is vital. The Package Name serves as the key for such tracking – and hence, you need to choose a unique name, to avoid confusions later on. Most app companies feel that it is best to go with a com.mycompanyname.myapplication format.
Note: The above steps should have enabled you to create a basic ‘Hello World’ app for Android.
9. Run your application – You have three different ways to run Android apps in the Android Studio system. From the IDE itself, run it by clicking ‘Run’. Select ‘Choose a running device’ → ‘OK’ in the ‘Choose Device’ window that pops up next. From the command line, developers can build new projects in debug mode with the help of Gradle. Once the .apk debug file is created, type $chmod +x gradlew (on Mac) or >gradlew.bat assembleDebug (on Windows). Install a ‘MyFirstApp-debug.apk’ file, find it on your device and run it. On handsets running on Android 4.0 or higher, you can enable USB debugging, under Settings → Developer Options.
Note: On Android 4.2 Jellybean or later phones, you need to go to Settings → About Phone, and then tap the ‘Build Number’ tab 7 times.
10. Adding list views and including rows – This bit can be just a bit confusing for new Android developers (if you have worked on the iOS platform earlier, you will have some idea). For all the views you want in the UI (including labels and buttons), you will have to define and add XML tags. XML attributes are required for defining properties like colour and position. Next, a ‘list view’ has to be created – which will fully fit the system screen. You can now add rows to the list view. Remember that every row needs to have a text as well as a thumbnail.
11. What’s this thing called Emulators? – Irrespective of whether you use Eclipse or Android Studio, you will have to create Android Virtual Device(s) first. These AVDs are generically known as ‘emulators’. Tools → Android → AVD Manager is the path to follow, to launch an emulator in Android Studio. In Eclipse, you need to select ‘New’ in the ‘Android SDK and AVD Manager’ dialog box that appears. Make sure that the SD Card Size is set at 16 MiB. After the emulator boots, the app is automatically run on it.
Note: For separate versions of Android, different AVDs can be created and used in Eclipse.
12. Customize your app – When you make a mobile app, you simply have to assign maximum importance to its usability. For this, adjusting the application to make it compatible with different screen sizes and platform versions is essential. Use your raw vector resources to prepare the layout and generate images of different size-scale and density for hdpi (1.5), Idpi (0.75), xhdpi (2.0) and mdpi (1.0) generalized densities. There are four separate size forms as well – large, small, normal, xlarge. For customizing the app for multiple platform version support, mobile app developers have to properly define the ‘Target’ and ‘Minimum’ API levels, as well as monitor the system version during runtime. To bolster the chances of high initial downloads (vital for a new app’s ranking at the Play Store), you should provide multiple language support as well.
13. Use Fragments to make your app dynamic – It’s time to polish the UI of your app and make it more immersive and user-friendly. Provided that you are on Android Studio, you can use the ‘Fragment’ class – for lifecycle management and specification of the layout (each ‘fragment’ has its own layout). Make the overall UI flexible, so that users get different views on devices with different screen sizes. For instance, a tab can show two fragments simultaneously – but on a smaller screen, only one fragment will be viewable at a time. In Eclipse, you have to learn how to manage the QuoteReaderActivity.java and the QuoteReader.java files. An AndroidManifest XML file is required too.
14. Monitor the performance of your app – Is the app you made a memory/bandwidth hog? This is something you need to know, and if required, rectify, during the Android app testing phase. For checking the memory allocation requirements of your application, use the ‘Allocation Tracker’ in Android Studio. Using ‘Heap Dump’ files to check memory usage is advisable. An overview of the app’s performance can be obtained from the custom ‘CPU and Monitor View’ in the IDE. For verifying expressions, references and variables, the inline debugging method is quick and developer-friendly.
15. Get your developer license – Unlike the $99 that iOS app developers have to pay annually to remain in the Apple Developer Program, becoming a licensed Android developer is a way cheaper affair. You will have to pay a one-time fee of $25, use a keytool command to generate a private key (which doubles up as the signature on your app), and then, compile the project in Release mode. You should now be ready to submit your app to the Play Store.
On average, an Android app development project takes twice the time required to create an iPhone app. In November, the total number of apps in Play Store breached the 1,800,000 mark. Depending on whether you are using Android Studio or Eclipse, there are many other advanced things to be learnt (for system permissions, data saving, location sharing, graphics/animation, etc.). This discourse was about the very basics of making Android applications – and once you have mastered these steps, you can move on to making more complex, realistic and useful applications.