550 likes | 710 Vues
Android 1: Background. Kirk Scott. 1.1 Buzzwords 1.2 Development Software 1.3 Getting Started 1.4 Preliminaries to Trying to Make It Work the First Time. 1.1 Buzzwords…. The Android platform originated in a separate company It was acquired by Google
E N D
Android 1: Background Kirk Scott
1.1 Buzzwords • 1.2 Development Software • 1.3 Getting Started • 1.4 Preliminaries to Trying to Make It Work the First Time
The Android platform originated in a separate company • It was acquired by Google • It is supported by the Open Handset Alliance (OHA) • From a business perspective, Android is distinguished by the fact that many vendors are cooperating to provide a non-proprietary development environment
Key components of this successful alliance are: • Hardware device manufacturers • Mobile service providers • Android/Google, which provides the basic software operating and development environments • Independent app developers marketing through the app store or other places
The platform is based on: • A secure operating system, Linux • Virtual machines running on top of Linux (known as Dalvik virtual machines) • A widely-known object-oriented language, Java • A tested software development environment, Eclipse
Proprietary vs. non-proprietary • Android is based on open source licensing • Developers do not have to pay fees to use the development tool kit • The do not have to pay fees on the apps developed with it • The app developer API includes everything that a “native” programmer would have access to
The theory is that there is a large potential market • By opening up the environment, you increase the size of the pie for everyone • Android is growing from phones to tablets to other devices • The growth is being driven by the app market
Another useful aspect of the development environment: • It comes with an emulator for handheld devices • This means that you can initially develop and test code on a PC with the development environment installed • You don’t literally have to develop on the handheld device
Emulation isn’t the be-all, end-all: • The emulator is slow • The emulator can be problematic • The emulator may not fully model the hardware device of interest • The reality is that you eventually have to test and finish development on a hardware device if you expect to roll out the app on that device
Versions • You may have heard of “Ice Cream Sandwich” (ICS) or Jellybean • As of the writing of these overheads, these are the most recent versions of the Android SDK • It is worthwhile to note that the latest versions essentially merge two strains in Android: • Development for cell phones and development for tablets
You may also be curious about how versions were named • The different versions have been named after sweets in alphabetical order • Here are the versions and names • 1.5, Cupcake • 1.6, Donut • 2.0/2.1, Eclair
2.2, Froyo • 2.3, Gingerbread • 3.0, Honecomb • 4.0, Ice Cream Sandwich • 4.1, Jellybean • Note that this list is more than just a historical curiosity • As with any growing system, backwards compatibility is an issue, and there are plenty of systems out there using earlier versions
To start developing for Android you essentially need to download and install two pieces of software: • The Java SDK • The Android Development Toolkit (ADT) bundle • The bundle includes Eclipse • It includes Android classes for development • It includes the emulator so that you can start to learn development without access to an Android hardware device
As with all growing and changing systems, documenting installation and use is hopeless • As soon as you write something down, it’s out of date • These overheads are designed for computer literate persons, in other words, computer science students
Entry points and some guidance are given • Persistence and a willingness to fiddle around are required • Experience has shown that most students are actually better at this than the teacher
The actual physical device that I have to work with is a Nexus 7 running Android version 4.2.2 • These overheads were initially created after installing Java v. 1.7.0_11 and Android v. 4.2 API level 17
Updates have occurred since then to API 18, v. 4.3 • This has resulted in some problems • I have tried to straighten these problems out and fix the overheads wherever necessary • Whenever development environment updates occur midstream, expect to have to adapt
Downloads • Since Java was acquired by Oracle, the entry point for downloading Java is www.oracle.com • On that Web page there is a link for downloads • Under that heading you can find Java for developers • Find the right SDK for your system and install it before installing the Android tools
The highest level entry point for Android is www.android.com • On this Web page you’ll find a link for developers or you can go directly to developer.android.com • Find the ADT bundle which is right for your system and install it • For the time being, just accept the defaults, whatever they might be
The Android Web Site • Virtually anything you might want to know about Android programming can be found at the developer’s Web site • The site includes tutorials on app development • It includes Java-like documentation of the packages and classes in the Android API • It includes detailed technical information
Overhead Contents • The problem is the eternal one: • There is too much information • The average programmer doesn’t know where to start and can’t distinguish the essential from the interesting or the overwhelming • The purpose of this set of overheads and those that may follow is to provide the barest guide to getting started
There are two important principles at work here that kitchen-sink Web site and textbook authors seem to be unfamiliar with: • 1. There are lots of things that you simply don’t have to be told about at the beginning • There may come a time in the future when some overlooked items will be introduced, but until then, ignorance may not be bliss, but it’s necessary
2. There are lots of things where you will have to accept that they exist and learn how to use them at a minimal level without having any idea of how they work • In other words, at the beginning you will be doing a lot of monkey work just to get the Android machinery to run a painfully simple app • For the time being you will have to accept the machinery without explanation
The starting point for the following overheads is a successful installation of Java and the ADT bundle on your system • Once the ADT is installed, your entry point into Android development will be Eclipse • This isn’t an introduction to Eclipse—some will already have used it—others will have to pick it up as they go along
What is included with Eclipse as part of the ADT bundle: • There is an Android SDK Manager tool • There is an Android Virtual Device Manager tool • And there is a DDMS (DalvikDebug Monitor Server) perspective
The Android SDK Manager tool allows you to keep the SDK installation up to date • The icon is the top half of the Android with a down arrow in place of the bottom half
The Android Virtual Device Manager tool allows you to set up virtual devices to test your software on • It’s located next to the Android SDK Manager tool • The icon is essentially the one shown below, but on the screen it’s so microscopic that you might not recognize it
Off to the right of the toolbar there is an option that allows you to select a perspective • If you are in the code development environment, Java will be shown on a button • One of the other options is DDMS • These are Eclipse perspectives • You can pick the perspective you want depending on what part of development you are working on
DDMS • DDMS is Android related • It stands for Dalvik Debug Monitor Server • At the moment it’s too soon to give much detail about the DDMS perspective except that it should be available after a successful installation
Dalvikis the name of the virtual machine that Android apps run on • It is based on the Java virtual machine • It is designed to have good performance on a device with the limitations of a cell phone, for example
The Eclipse Interface • A screenshot of the Eclipse interface is shown on the following overhead • Things come up tiny, but you may just be able to identify the tools and buttons • The point is that Android things are included in the toolbar when you successfully install Eclipse as part of the bundle • These tools are also available through the menu if the toolbar isn’t showing
The Android SDK Manager • A screenshot of the Android SDK Manager tool is shown on the following overhead • As noted, the tool allows you to manage and update what is installed on your development machine
The Android Virtual Device Manager • A screenshot of the Android Virtual Device Manager tool is shown on the overhead following the next one • At the moment the details are unimportant • We will be using the tool soon enough
It is presented now because it emphasizes the idea that you can develop on an emulator • The “virtual device” manager is that part of the environment which makes it possible to define and manage emulators for the many different kinds of handheld devices there are • Even though emulation isn’t perfect, it’s a helpful part of the development environment that you can try out an application on different devices in this way
Preliminary Crying • Trying to make things work the first time is where a miracle is supposed to occur • It’s not realistic to expect any set of instructions or screen shots to preview exactly what you will have to do to make things happen or to anticipate all of the problems that might occur along the way
Your hardware is probably different • Your installation of the software may be different • I initially had mismatches between 32 bit and 64 bit software for Java and the Android SDK which I had to resolve • It is possible that you will be using different versions from what I’ve used
I had one completely unexpected problem with no hope of solving it except a random Web search • The Web search succeeded • I had other problems where there was no apparent solution, and I finally got things to work by restarting, randomly trying different parameters, etc.
I initially worked on the first example app over the course of 24 hours, probably 8-12 actually messing with Android • I tried to get the initial example app going about 10 times • I literally had success 2 of those times
You should be prepared for failure and frustration • You will have to be flexible, analytical, and persistent • Aside from everything else, you will have to be patient • You will probably do better than I did the first time
The Emulator: Boon or Bane? • I am pretty sure that most of my problems came from the fact that starting the emulator is painfully slow • It is unbelievable how slow this is on an up-to-date, reasonably powerful machine with a reasonable amount of memory • The point is that if you try to launch an app on an emulator that hasn’t yet fully started, the app certainly won’t run
Workspaces • These overheads don’t give any specific information about workspaces • However, the Eclipse environment organizes projects and packages in workspaces • At some point during installation, set-up, or initial run, you will probably be given the option to either accept a default folder as a workspace or to specify your own
Needless to say, this is important for general reasons: • It’s handy to know where things are being stored • At various points along the way, it will be useful to recall that information