A journey with “Embedded programming with Android”: part 1

I purchased the Kindle edition of this book: https://www.amazon.com/Embedded-Programming-Android-Bringing-Scratch-ebook/dp/B013IQGX3A

and since I’m going through the book in 2019, there are a few gaps to bridge.   The first was creating an emulator.  I did this via command line, and step 1 was to get a basic Android SDK downloaded.  I use Vagrant/Virtualbox for my development, so this was used to set up the SDK

put this here

Once that’s done, I need to configure my emulator to use Android API 15.  To get an idea of what I can install, I use the sdkmanager tool to list all the available options:

$ANDROID_HOME/tools/bin/sdkmanager --list

Which gives a bunch of output, but I’m only interested in the android-15 results:

  system-images;android-15;default;armeabi-v7a      | 5    | ARM EABI v7a System Image
  system-images;android-15;default;x86              | 5    | Intel x86 Atom System Image
  system-images;android-15;google_apis;armeabi-v7a  | 6    | Google APIs ARM EABI v7a System Image
  system-images;android-15;google_apis;x86          | 6    | Google APIs Intel x86 Atom System Image

The book says we’ll be developing for arm, and I don’t think I’ll need Google APIs, so Ihoose the armeabi-v7a.  I don’t know how this is all going to fly in Virtualbox either, so I yolo by running the following command and accepting license with “y”.

$ANDROID_HOME/tools/bin/sdkmanager "system-images;android-15;default;armeabi-v7a"

Cool.   Now to create an emulator image, right?  I don’t have any idea of how to configure it via command line, but I’ll try and feel my way through:

$ANDROID_HOME/tools/bin/avdmanager create avd --name mytestavd --abi default/armeabi-v7a --package "system-images;android-15;default;armeabi-v7a"

Which results in “Error: “emulator” package must be installed!”

Ok, let’s install that (and wait!):

$ANDROID_HOME/tools/bin/sdkmanager emulator

And then I try re-running the command to create the avd, this time successfully.  I answer “no” to creating a custom hardware profile, as I answered “yes” the first time and didn’t know what to answer for some of the questions.  I believe I can play around with this at a later time.  Now where did that go?   Find out with this command:

 $ANDROID_HOME/tools/bin/avdmanager list avd

Output:
Available Android Virtual Devices:
    Name: mytestavd
    Path: /home/vagrant/.android/avd/mytestavd.avd
  Target:
          Based on: Android 4.0.3 (IceCreamSandwich) Tag/ABI: default/armeabi-v7a

So, it seems like we may have some basic steps done.  More will be done in a part 2 of this post, hopefully in the New Year.

Kristian Golding

View more posts from this author