I recently decided to explore Android development. In the past I’ve explored several platforms, mostly just out of interest. Unity Game Engine, with scripting in C#. Adobe Animate (Flash), with scripting in ActionScript 3. Also I teach basic courses in Java and PHP at a tertiary college, although I’ve never been a professional developer.
Anyway, Android. I may be retiring soon, and I want to explore the world of app development. Being a baby boomer I use my phone to make phone calls (and text messaging). I spend most of my life in front of a PC or laptop, and don’t use mobile devices much, so I need to get up to speed on how it all works. I do have an iPhone and iPad, but am not interested in developing for Apple. I can’t even find a filesystem on Apple devices. Everything is done through apps. Perhaps it’s just me.
So I downloaded Android Studio 3.2, the latest stable release. Seems that this does not require that you have a JDK installed, as it uses its own JRE (and presumably has a compiler in there somewhere). It’s based on IntelliJ IDEA, which is an IDE I’ve been thinking of installing for Java recently although I opted for the new Apache NetBeans 9 instead.
Picking up a new platform I generally rely on books (baby boomer, remember) supplemented with video tutorials generally from Lynda as I have access to that through my work. Books these days are Kindle editions as I’ve run out of room to store any more actual physical books. And here’s where the first problems arose. Android is complex and rapidly developing. Most training material is out of date to some extent. I’ve rarely had to concern myself with different versions of Java, but with Android it’s a big deal. When a particular book says to use API level 19 because nearly 100% of devices will be able to run it, this turns out to be Android 4.4, otherwise known as KitKat. Also, it’s not installed on my computer. Android Studio only installs the latest SDK, currently 9.0 (Pie) and you have to tell it to install any previous ones if you want to use them. You use the SDK Manager for that. Also, there’s a Compile SDK version, a Minimum SDK version, and a Target SDK version. Not sure how the Minimum and Target are related to each other. By default they’re not the same. Anyway, I now have quite a few Android SDKs installed.
For testing I’m using the emulator in Android Studio, although that doesn’t always work. I created one virtual device (Nexus 7) as I’m thinking of buying an actual tablet with that configuration, but all I got was a message “Waiting for target device to come online…” The virtual device displayed on the screen but didn’t display the content of the app I was working on. Fortunately other virtual devices worked fine. And on the note of real devices, my local OfficeWorks says that the Samsung Galaxy Tab 8” is running Android 7 (Nougat). Don’t these devices upgrade the OS on a regular basis? My iPhone and iPad frequently upgrade to the new version of IOS.
Layouts are specified in XML files. I’m fine with that, as I actually taught a fairly low-level course in XML a few years ago and did a lot of reading on the subject. However Android Studio’s default layout these days is a constraint layout manager that reminds me a lot of GridBagLayout in Java. So far no example that I’ve come across in my studies uses that, but rather they’re using ‘Legacy’ layouts instead such as LinearLayout or RelativeLayout. The only way to change the layout is to edit the code, which fortunately is not that hard to do.
Some aspects of using Android Studio are far from obvious. I wanted to add a particular image to the screen, but where to put it? I eventually discovered that you have to find the res directory in the project directory tree, right click on the drawable subdirectory and select Open in Explorer. Then you can paste an image in. And remove characters that are not permitted in the filename, such as dashes. I found that out from the error message when my image failed to display. At least I know that now.
Once I get my head around the Android environment I’ll focus on developing stuff and sharing my insights, and some tips on programming in Java, with the trybe community. I’m excited to be getting into real development at last.