Last week Google released a new version of the Android Development Tools (ADT). If you've not updated to version 11 yet, then DO IT NOW! There are a number of big improvements that will enhance your app development process, particularly regarding layouts and XML editing. Take a look at the video below for details of the update made at Google I/O 2011, if you've been developing on Android for a while, this should really get your juices flowing!
If you're not already then you should be following the Android Developers Blog (or @AndroidDev on Twitter).
How do update my tools in Eclipse?
Make sure you are running Eclipse as Administrator, then go to Help > Check for Updates.
Now just step through the sequence, agree to license terms then restart Eclipse when prompted.
Showing posts with label platform. Show all posts
Showing posts with label platform. Show all posts
Monday, 13 June 2011
Cannot install Android Development Tools / DDMS
If you see the following error when updating you Android Development Tools and DDMS in Eclipse on a Windows PC, you need to run Eclipse as Administrator.
"The operaton cannot be completed. See the details."
"Cannot complete the install because of a conflicing dependency."
"The operaton cannot be completed. See the details."
"Cannot complete the install because of a conflicing dependency."
![]() |
| Cannot complete the install because of a conflicing dependency |
Tuesday, 17 May 2011
Best Eclipse Shortcuts
There are many sites listing their top Eclipse shortcuts, but for what it's worth I would like to add my most used keyboard shortcuts since starting with Eclipse...
Ctrl + Shift + O = organise and import missing imports
Alt + Shift + R = refactor (rename variable or method)
Ctrl + 1 (one) = Quick fix popup
Ctrl + D = Delete line
Ctrl + O = Outline (easily navigate to parts of project)
Ctrl + M (or double-click tab) = Maximise source when coding
Ctrl + . = Jump next error or warning
Ctrl + Shift + R = open resource (start typing any file name - like indexed search)
Ctrl + Shift + F - Formats code to settings defined under Window > Preferences > Java > Code Style > Formatter
Ctrl + Shift + O = organise and import missing imports
Alt + Shift + R = refactor (rename variable or method)
Ctrl + 1 (one) = Quick fix popup
Ctrl + D = Delete line
Ctrl + O = Outline (easily navigate to parts of project)
Ctrl + M (or double-click tab) = Maximise source when coding
Ctrl + . = Jump next error or warning
Alt + UP / Alt + DOWN = Move selection up or down
Alt + LEFT / Alt + RIGHT = Jump to recently edited sections
Ctrl + Shift + R = open resource (start typing any file name - like indexed search)
Ctrl + Shift + F - Formats code to settings defined under Window > Preferences > Java > Code Style > Formatter
Tuesday, 10 May 2011
First Steps: Android project structure in Eclipse
![]() |
| Android Project structure in Eclipse |
- Project root folder (see 7 for details of individual files)
- src folder. This is where your java code files are stored.
- package folder. This is organised by package name with the java class files within.
- Main.java is a java class file, in this case the main activity. Note the exclamation denoting a compilation warning.
- Web.java is another java class (without warnings or errors).
- gen folder. The generated compiled files when a project is built. You do not need to venture into this folder.
- Google APIs folder. The API library folder.
- assets folder. This is where you place additional assets for use in your project, such as font (ttf) files.
- res folder. This is where the resource files are stored, such as your drawables (images), layouts and string values.
- drawable-hdpi folder. High density drawables (images) for use in your project.
- drawable-ldpi folder. Low density drawables (images) for use in your project.
- drawable-mdpi folder. Medium density drawables (images) for use in your project.
- layout folder. This contains the XML layout files that define the screens in your project.
- main.xml. This is the layout for the Main activity, defined in Main.java.
- web.xml. This is the layout for the Web activity, defined in Web.java.
- values folder. This is where your string (text) definitions are stored. To support multiple languages you would find a values folder per language, for example values-fr.
- strings.xml. A standard XML file containing named string definitions.
- AndroidManifest.xml - The hub of your project containing the details on the Activities, Permissions within your app.
- default.properties -An auto-generated configuration file storing the basic project properties.
- proguard.cfg - ProGuard can be used to obfuscate your code to prevent nasty code thieves from stealing your secrets. By default this is not applied to the code but the configuration file is still present.
Typically you will place any additional referenced Java libraries (.jar files) into a libs folder.
Hopefully this will help an Android newbie opening up a new project for the first time.
Hopefully this will help an Android newbie opening up a new project for the first time.
Labels:
getting started,
guide,
platform
Monday, 18 April 2011
Android Versions
Android Platform Versions, API Levels and Names
Each Android platform release or update is given an incremental API version and also the name of a dessert, to make discussions on the subject easier to swallow (ho ho). The dessert names run in alphabetical order and are always hotly speculated prior to release.
The table below lists the Android versions with their API level and also dessert name. The list strikes-through versions that were not released or are declared obsolete:
It is always worth keeping and eye on the latest Android Platform Versions statistics provided by Google.
How do I find the Android platform version my app is running on?
In your app you can test for the version of Android that is running with the following code:
Each Android platform release or update is given an incremental API version and also the name of a dessert, to make discussions on the subject easier to swallow (ho ho). The dessert names run in alphabetical order and are always hotly speculated prior to release.
The table below lists the Android versions with their API level and also dessert name. The list strikes-through versions that were not released or are declared obsolete:
| Platform Version | API Level | Name |
|---|---|---|
| 1.5 | 3 | Cupcake |
| 1.6 | 4 | Donut |
| 2.1 | 7 | Eclair |
| 2.2 | 8 | Froyo |
| 2.3 | 9 | Gingerbread |
| 2.3.3 | 10 | Gingerbread |
| 3.0 | 11 | Honeycomb |
| 3.1 | 12 | Honeycomb |
| 3.2 | 13 | Honeycomb |
| 4.0 | 14 | Ice Cream Sandwich |
| 4.0 | 15 | Ice Cream Sandwich |
| 4.1 | 13 | Jelly Bean |
It is always worth keeping and eye on the latest Android Platform Versions statistics provided by Google.
How do I find the Android platform version my app is running on?
In your app you can test for the version of Android that is running with the following code:
if(android.os.Build.VERSION.SDK_INT < 8) {
// Do something for versions less than 2.2
}

