Android apps are big business, but the native development tools aren’t exactly beginner-friendly. There’s a laundry list of technical concepts you need to master before you can write even a simple “Hello world!” program. You also have to learn to work with Eclipse, an open source development environment with plenty of quirks.
Happily, you don’t have to use native tools. Absolute beginners can assemble their own programs in a visual environment using the free MIT App Inventor service. And for those seeking a more hands-on approach, it’s possible to create, share and publish apps using a friendly Basic-type language, without having to deal with the more abstruse aspects of native Java development.
Basic options
One free option is RFO Basic for Android, an open source programming environment that’s free to download from Google Play. It’s modelled on “classic” Dartmouth Basic, so it’s very easy to get up and running. However, since the package runs entirely on your smartphone or tablet, you don’t get the conveniences of a Windows-based development environment – nor, with most devices, a physical keyboard.
We’ve therefore chosen to focus instead on Basic for Android (or B4A for short), a Windows-based package that’s modelled on Visual Basic (VB). It isn’t quite as simple as RFO Basic, but it’s much easier than diving straight into Eclipse and Java – and much closer to the native Android way of doing things, giving you a leg-up if you choose to graduate to native programming later on.
Unlike RFO Basic, Basic for Android is a commercial product. A free 30-day trial is available from the developers’ website, and this is all you’ll need to follow this month’s introduction to the language. However, the trial doesn’t support external modules and libraries, so to create more advanced apps, you’ll need a full licence. This costs $49 (around £30) and includes two months of updates, as well as entitling you to post questions and download code snippets from the B4A forums. Options are also offered for longer update periods and multiple developers.
In this feature, and in the accompanying second part, we’ll get you started with the language and the development environment, after which you can go on to build more advanced programs with the aid of the official documentation and user forums – and we’ll even show you how to publish and sell your creations on Google Play.
Setting up Android
Basic for Android runs within Windows, but Android programs won’t work on your desktop – they must be tested on an Android device. The trial version of B4A includes a feature called “remote compilation”, which beams your code to a mobile phone or tablet for testing. At present, though, this works only for simple programs and isn’t in the full version of B4A.
A more flexible way to test your code is to compile it locally and run it in an Android Virtual Device (AVD) – an emulator, in other words. This is slower than using a real device, but it lets you test your code at any resolution. To set this up, you’ll need to install the Java Development Kit and the Android SDK; our walkthrough shows you how.
Compiling your first Android program
Once you’ve installed Java and the Android SDK, and created your AVD for testing, it’s time to configure Basic for Android. If you’re using the trial version of B4A, the IDE opens containing a placeholder program, which simply pops up a message box. We can run this program to test everything is working – but first we need to direct B4A to the resources it needs for compiling Android apps.
To do this, check that Remote Compilation Mode is unticked under the Tools menu, then select Tools | Configure Paths. You’ll be prompted to provide paths to the needed Java and Android components. If you’re using 64-bit Windows, look in the Program Files (x86) folder rather than the main Program Files folder as suggested. Leave “Additional libraries” blank for now.
Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.