What languages Should You Learn if You Want to Become an Android Developer?
Bytes: Android apps can be rewarding, both personally and financially. Assuming you have a certain level of technical knowledge then it is possible to develop Android apps yourself, but what programming languages do you need to learn? Actually, you have a number of options.
The official language for Android development is Java. but is Java enough? Large parts of Android are written in Java and its APIs are designed to be called primarily from Java. That said, it is possible to develop C and C++ apps using the Android Native Development Kit (NDK), however it isn’t something that Google promotes. According to Google, “the NDK will not benefit most apps. As a developer, you need to balance its benefits against its drawbacks. Notably, using native code on Android generally does not result in a noticeable performance improvement, but it always increases your app complexity.”
Java is a programming language first released by Sun Microsystems back in 1995. It can be found on many different types of devices from smartphones, to mainframe computers. You can use it on your desktop PC and even on the Raspberry Pi. Java doesn’t compile to native processor code but rather it relies on a “virtual machine” which understands an intermediate format called Java bytecode. Each platform that runs Java needs a virtual machine (VM) implementation. On Android the original VM is called Dalvik. Google has also started previewing its next generation VM called ART. The job of these virtual machines is to interpret the bytecode, which is really just a set of instructions similar to the machine code found in CPUs, and execute the program on the processor. The VMs use a variety of technologies including just-in-time compilation (JIT) and ahead-of-time compilation (AOT) to speed up the processes.
What this all means is that you can develop Android apps on Windows, Linux or OS X and the Java compiler converts the source code into bytecode. This in turn is executed on the VM built-in to Android. This is different to the model used by iOS which uses a native compiler to turn Objective-C into ARM machine code.
You might also want to look at the following tutorials:
- Getting Started — An introduction to Java technology and lessons on installing Java development software and using it to create a simple program.
- Learning the Java Language — Lessons describing the essential concepts and features of the Java Programming Language.
- Essential Java Classes — Lessons on exceptions, basic input/output, concurrency, regular expressions, and the platform environment.
- Tutorials Point – Java Tutorial
- Introduction to Programming Using Java
Once you have learned Java, the next step is to learn how to use Java to create Android apps. For that you will need the Android Software Development Kit (SDK). The Android SDK provides all the API libraries and tools you need build an Android app. Google offers the Android Developer Tools (ADT) bundle which includes the SDK, a version of the Eclipse IDE with the ADT plugins, and the Android Platform-tools with the Android emulator.
Developing an Android app is more than just Java, you need to understand how the Android UI is constructed (using XML), and how to access the different Android subsystems. Google has a series of tutorials about Android development. The Getting Started tutorial shows you the bare essentials of Android app development.
If you don’t want to learn Java or how to design user interfaces in XML, then there are alternatives. One is to use the Corona SDK. Corona is a high level SDK built on the LUA programming language. LUA is much simpler to learn than Java and the SDK takes away a lot of the pain in developing Android app. A simple app which displays a background image of your choice and writes some text on the screen can be written in just 3 lines of code with Corona.
Corona includes a sophisticated emulator which allows you to run your program instantly without needing to compile your code. When you want to create an Android .apk file you start a build via Corona’s online compilers and the app is saved to your PC.
Corona is designed mainly for games (but not exclusively) and as such includes libraries for sprites, audio, game networking and a 2D physics engine. Almost everything in Corona is displayed via OpenGL. This means you get GPU accelerated graphics, plus the default app is a blank canvas, all you need to do is start painting!
Corona is free to download and use, but if you want features like in-app purchasing or the ability to call native Android APIs you need to pay a monthly subscription fee.