09 DecUpdating Eclipse to Gingerbread
Thursday, 09 December 2010 — 14:37Hi Android developers!. Gingerbread is finally out there. At least the SDK is now available for developers. If you’re thinking about adding the new SDK component to Eclipse, please, take into account this before proceeding. This will save you some time.
1. Disable Automatic Build (Project→Build Automatically)
2. This is a good time for updating your Eclipse: Help → Check for updates
3. Open Android SDK and AVD Manager (It’s under Window if you don’t have a shortcut in Eclipse)
4. Look at available packages and install the new 2.3 SDK in addition to any other packages you didn’t have. In my case there were some code examples i hadn’t installed yet
5. Once everything is installed, you should create a new Virtual Device and make sure your other virtual devices didn’t get broken
One of the main changes you will see is that adb/aapt,.. commands are not under tools anymore. Now those are common commands for all the SDKs you have installed in your computer and they are under
Also, make sure you are pointing to the root folder holding all your SDK folders from Eclipse→Preferences→Android ( i said your root folder, not tools, or platform-tools or anything like that).
Go to your project folder and remove everything under gen folder. With the automatic build disabled, execute a Project Clean (Project → Clean…). Now start building your project (Project → Build Project). Did it work?. it didn’t to me. Don’t get nervous if you get 600+ errors. Probably is because your resources didn’t get updated.
Even if your project target sdk is not 9 (SDK 2.3), you can have a problem with your resources (did i say that now all your projects are built through common tools?:-) ). One of the changes is related with how you define strings that will be used for formatting text, like this:
<string name="welcome_label">Hi %s, today is %s</string>this will not work with the update. See here more documentation about this. It will have to be replace with:
<string name="welcome_label" formatted="false">Hi %s, today is %s</string>
or
<string name="welcome_label">Hi %1$s, today is %2$s</string>
This means that first argument passed through String.format will go after “Hi”, and second one, after “is”. This is useful for some languages, where some arguments might come at the end of the sentence instead of at the beginning as an example. Update your Strings resources, and build again. Did it work this time?. I hope so
Ger