How unit 1 is examined
This unit covers the Android platform and SDK, setting up Eclipse with ADT and an emulator, building a first app, the project anatomy and the manifest file; no topic was asked in the supplied papers, so each is kept short.
The Android Platform
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>Android is an open-source, Linux-based mobile operating system, developed by Google and the Open Handset Alliance, that provides a complete software stack for mobile devices.</mark>
Key points.
- The stack has four layers: the Linux kernel at the bottom, then native libraries with the Android Runtime, then the application framework, and applications on top.
- The Linux kernel handles drivers, memory, process and power management, and security.
- Native libraries such as SQLite, WebKit, OpenGL ES and libc sit beside the runtime (Dalvik VM in older versions, ART in newer ones) that runs app code.
- The application framework gives apps managers such as the Activity Manager, Content Providers, Resource Manager and Notification Manager.
- Applications, such as Home, Contacts and Browser, are written in Java and run in their own process.
Android SDK
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>The Android SDK is the Software Development Kit of libraries, tools and documentation needed to build, test and debug Android applications.</mark>
Key points.
- It contains the Android API libraries for each platform version, so an app can target a chosen API level.
- The emulator runs an Android Virtual Device (AVD) so apps can be tested without a phone.
- The Android Debug Bridge (adb) connects the developer machine to a device or emulator to install apps and read logs.
- DDMS and Logcat help inspect running processes and debug messages.
- The SDK Manager downloads platform versions, system images and sample code.
Eclipse Installation
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>Eclipse is a free Java IDE that, with the Android Development Tools (ADT) plugin, was the standard environment for writing Android apps.</mark>
Steps.
Step 1: Install the Java JDK and set JAVA_HOME.
Step 2: Download and unzip Eclipse IDE for Java.
Step 3: Download the Android SDK and unzip it.
Step 4: In Eclipse choose Help > Install New Software and add the ADT plugin URL.
Step 5: Install ADT, restart Eclipse, and set the SDK path in Window > Preferences > Android.
Key points.
- The JDK must be installed first because Eclipse and the Android build both need it.
- ADT connects Eclipse to the SDK and adds the layout editor, build tools and emulator launcher.
Android Installation
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>Android installation here means setting up the SDK platforms and an emulator (AVD) so that apps can be run and tested.</mark>
Key points.
- Open the SDK Manager and install at least one platform, the platform-tools and a system image.
- Open the AVD Manager and create a virtual device by choosing its name, target API level, screen size, RAM and SD card.
- Start the AVD; the emulator boots a full Android system on the computer.
- To test on a real phone, enable USB debugging in Developer options and connect it by USB; adb then lists it as a device.
Building you First Android application
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>A first Android application is a simple Hello World project created with the New Android Application wizard and run on the emulator.</mark>
Steps.
Step 1: File > New > Android Application Project.
Step 2: Enter the application name, project name, package name and the minimum and target SDK.
Step 3: Choose the launcher icon and create a blank activity with its layout.
Step 4: Edit res/layout/activity_main.xml or the activity Java code if required.
Step 5: Right-click the project, choose Run As > Android Application, and select the AVD.
Key points.
- The output is a Hello World screen showing a TextView with the text from strings.xml.
- The build packs the code and resources into an .apk file that the emulator installs and launches.
Understanding Anatomy of Android Application
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>The anatomy of an Android application is the folder structure of an Android project and the role of each of its parts.</mark>
Key points.
- The src folder holds the Java source code, including the activity classes.
- The gen folder holds R.java, an auto-generated file that maps each resource to an integer ID.
- The res folder holds resources: drawable for images, layout for XML screens, values for strings, colors and styles, and menu.
- The assets folder holds raw files that are read as they are, and libs holds external jar files.
- AndroidManifest.xml describes the application to the system.
Android Manifest file
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>AndroidManifest.xml is the XML file in the project root that declares the application's package, components, permissions and requirements to the Android system.</mark>
Key points.
- The root element is
<manifest>, whose package attribute gives the app its unique identity. - The
<application>element contains a declaration for every activity, service, broadcast receiver and content provider; a component not declared here cannot run. - An
<intent-filter>with the MAIN action and LAUNCHER category marks the first activity that starts. <uses-permission>requests permissions such as INTERNET, and<uses-sdk>states the minimum and target API level.
<manifest package="com.example.hello">
<uses-permission android:name="android.permission.INTERNET"/>
<application><activity android:name=".MainActivity"/></application>
</manifest>
Last-minute revision
- Android is an open-source, Linux-based mobile OS from Google and the Open Handset Alliance.
- Stack, bottom to top: Linux kernel, libraries and runtime, application framework, applications.
- The SDK holds API libraries, the emulator, adb, DDMS and the SDK Manager.
- adb is the Android Debug Bridge that talks to a device or emulator.
- ADT is the Eclipse plugin that links Eclipse with the SDK.
- The JDK is installed before Eclipse.
- An AVD is a virtual device configuration run by the emulator.
- The build output is an .apk file.
- R.java in gen maps resources to IDs and is never edited by hand.
- AndroidManifest.xml declares components, permissions and the launcher activity.
Memory hooks
- Stack layers: K-L-F-A (Kernel, Libraries, Framework, Applications).
- Eclipse setup order: JDK, Eclipse, SDK, ADT, AVD.
- Project folders: src, gen, res, assets, libs.
- Manifest: "components declared, permissions asked, launcher marked".
Coverage checklist
- The Android Platform: definition and four-layer stack.
- Android SDK: API libraries, emulator, adb, DDMS.
- Eclipse Installation: JDK, Eclipse, SDK, ADT steps.
- Android Installation: SDK Manager, AVD, USB debugging.
- Building you First Android application: wizard steps and run.
- Understanding Anatomy of Android Application: src, gen, res, assets, manifest.
- Android Manifest file: package, application, intent-filter, permissions.