Click Ok, and then select the Developer Tools with a checkbox and continue with Next until Finish
Tell Eclipse where Android SDK is
After installing the Android Plugin (ADT), restart Eclipse
Tell Eclipse where the Android SDK is on disk
Eclipse will ask for this location when restarting the first time after the ADT has been installed
Can also be set/changed inside Eclipse
Choose "Window, Preferences, Android" and specify "SDK Location"
The list below "SDK Location" in this dialog box should contain all downloaded Android versions
This setting is stored as part of your Workspace, so changing to an empty Workspace means this might need to be specified again.
Create a new project (1/3)
Choose "File, New, Android Application Project"
The title shown to users when installing, below icon etc. Example: My Test Application
The name of the project folder in Eclipse workspace. Example: MyTest
Unique (reverse) domain name that identifies the application to the platform. Does not have to be a registered domain or site. Example: se.mobileapplab.mytest
Create a new project (2/3)
Minimum Required SDK
Oldest supported Android version where installable
The newest Android version that the developer is aware of and might have optimized for
Should always be the latest installed Android version to get the most recent tools/compilers
Default styles that will be applied to different components in the user interface
Use defaults for all other options and dialogs
Create a new project (3/3)
Sufficient to accept the defaults for all other options
Configure Launcher Icon
Choose Clipart, Choose and possibly change Background Color
Will be used for all examples in the course. Other types of activities can be added later.
A folder on disk that contains projects in subfolders and has a ".metadata" folder with settings
Project / Package
A package in Java is a collection of one or more classes with the same package name. Usually the same as a project, but a project can link to other packages/libraries
The contents of the Eclipse window, optimized for Writing code (Java) or debugging (Debug)
Rectangular area/panel in the perspective with specific content, commands etc. As tabs and dockable panels
Essential folders and files
Java source files
Important resource files in both xml and binary format. Different subfolders for different types of devices using qualifiers
Configuration of the app like title, included activities, permissions etc
Essential app objects
The basic object of all Android apps. Without an Activity, nothing will be displayed on the screen. An app must contain at least one Activity, but can contain more.
Generalization of the resources and other objects that relates to the application. You will use it as an argment in many calls, but you don't need to know anything more about it and you can always use the Activity (this) for the course's examples.
Essential visual objects
The basic visual object when building the user interface. All specific visual components are derived from the View. Can be buttons, input fields, formatted text, images etc.
A special View that contains other Views layed out on screen according to some rule(s). Can be a RelativeLayout, a LinearLayout or some other ViewGroup-derived class.
Also a layout that contains Views, but with added intelligence that makes it behave between a ViewGroup and an Activity. Was introduced in Android 4.0.
Eclipse keyboard shortcuts
Quick fix. Display menu with options for automatic changes
Show list of possible members for current object
Navigate inside of current file. Show list of class members
Navigate between opened files. Show list of all opened files (windows)
Close the current file/window.
Building and running in Eclipse
Eclipse is set to build automatically while you are writing code
Any build errors are shown continuously in the Problems view
Note that some errors are just an effect of you not being completely finished with your code
Start your app in Debug mode with F11
Will only work when java file is open! (not xml file)
First time, right click on the project and select "Debug As, Android Application"
Let Eclipse automatically switch to the Debug Perspective
Switch back when you're done with the "Java" button in the top right corner
Get out of an Eclipse jam
Have you tried turning it off and on again?
Project, Clean will delete all temporary files
If it claims that an R.id constant doesn't exist, when it does
When building errors doesn't make sense
Window, Reset Perspective
If the user interface is behaving strange, panels missing
If it is complaining that a file doesn't exist, that is clearly there
Delete ".metadata" folder in workspace
Eclipse settings will be lost - only last resort!
More Eclipse tips
Opened files can come from more than one project
Common to work in more than one project and open multiple files. Since many files in Android have the same name across projects, it is quite easy to work on a file in another project than what you THINK you are working on.
Location of Android SDK
If Eclipse have trouble finding the Android SDK, check it under "Window, Preferences, Android, SDK Location". The list below the path must have at least one Android platform version.
Errors while running your app
Run-time errors are called Exceptions
An Exception is thrown by the platform when a run-time error is discovered
When an Exception occurs
Eclipse will halt at location where exception was thrown
Eclipse switches to Debug Perspective
Unfortunately not always showing the location in your own code where the error is (depending on what kind of exception has occured). Look at least at the type of exception and any additional information in the Variables panel of the Debug perspective.
Set your own breakpoint (stop) by double-click in left margin before code line
Debugging keyboard shortcuts
Step through line-by-line
F5 - Step Into, will show/step inside of your own methods
F6 - Step Over, will NOT how/step inside of your own methods
F8 - Resume, run full speed until next breakpoint, end or an exception occurs
Console View in Eclipse
Commands that Eclipse runs when building and launching
Make sure to select the Android view (not DDMS)
LogCat View in Eclipse
Messages from the running Emulator or a connected device
Verbose, but can be filtered
Output your own LogCat messages
You can also output your own messages to the LogCat View using Log.i, Log.w and Log.e calls from your Java code
Deciding on an Android version
One single application
Can run on many different Android versions
Can check and adjust itself to take advantage of newer features on newer versions
If you call a member that does not exist on older version, app will crash
Multiple versions of the application
Build separate applications with different "Minimum Required" versions