Saturday, December 11, 2010

Android "Gingerbread" SDK - first issues

I downloaded Android "Gingerbread" 2.3 SDK with the new tools the same day it came out, and started to get nuch of errors with the string resources that were using formatting flags: SDK 2.3: Get "Multiple substitutions specified in non-positional format" error.

So the issue was that with the latest SDK tools the absence of positional identifiers in the resource string ends up flagged as errors. Here is a little bit more discussion on this problem:
http://groups.google.com

The solution is to change the resource strings to look like this:
Hello, %1$s! You have %2$d new messages.

Wednesday, October 06, 2010

Friday, October 01, 2010

tips on working with disk images

Just wanted to share a useful tip for working with disk images on Mac OS X.
I had to work with custom android builds recently and as you might know it requires case-sensitive partition or disk image to be able to compile it.

The following couple of functions added to .bash_profile make the mounting and unmounting the disk images easier from the command line:

function mountFroyo { hdiutil attach ~/froyo.dmg -mountpoint /Volumes/froyo; }
function unmountFroyo { hdiutil detach /Volumes/froyo; }

Now you can just type mountFroyo or unmountFroyo, for example, to mount/unmount your custom disk image.

Wednesday, September 08, 2010

How to compile Android 2.2 (Froyo) on Mac OS X 10.6 (Snow Leopard).

How to compile Android 2.2 (Froyo) on Mac OS X 10.6 (Snow Leopard).

Once upon a time I needed to do a custom build of Android OS with some changes to the core components for some custom devices.
The instructions how do get the source and do the build can be found on the Android Developers web site:
http://source.android.com/source/download.html
Everything went smooth, I took the latest code and compiled just fine, but.....
.... later I found out that I needed to have my build done based on Android 2.2 (Froyo) branch instead.

The "Froyo" build is not officially supported on the Snow Leopard and it didn't work right out of the box.
So, I had to spend a little bit of time to figure out how to make it work.

Here are the steps I had to go through:
* Follow the steps on http://source.android.com/source/download.html to get the source code and setup your build environment.
* Make sure you have XCode installed with support for Mac OS X 10.4(!) development.
* Install Java 1.5. This one a little bit tricky, since Java for Mac OS maintained by Apple and the older versions are pretty much not available to download. You have to download Java for Mac OS X 10.5 Update 7 http://support.apple.com/downloads/Java_for_Mac_OS_X_10_5_Update_7. Then use for example something like unpgk tool (http://www.timdoug.com/unpkg/) to exract the Java 1.5 from there. Replace the 1.5 and 1.5.0 symbolic links in
/System/Library/Frameworks/JavaVM.framework/Versions with the Java 1.5 from the package.
* I checked the Application->Utilities->Java Preferences as well to make sure the Java 1.5 is the first one in the list, although I'm not sure if it is necessarily. It worked and I didn't bother to try different settings.
* In order to start the build you would go to the root folder of the android source code tree and call "make".
* The first problem I stumbled upon was the problem with /Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h file it could not be found, while it existed in that directory. I found the solution that worked here: http://code.google.com/p/android/issues/detail?id=5000
Basically just coping the file : cp /Developer/usr/lib/gcc/i686-apple-darwin10/4.0.1/include/stdarg.h /Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h
allowed me to proceed further.

* The next problem was a error during compilation of google V8 javascript engine. I went ahead deleted the external/v8 folder and took the latest stable version from google repository: "svn checkout http://v8.googlecode.com/svn/trunk/ v8". As long as V8 compiled and run I was fine with this change in my tree.

* The next error that you would get is
host C++: libacc <= system/core/libacc/acc.cpp
system/core/libacc/acc.cpp: In member function ‘bool acc::Compiler::acceptStringLiteral()’:
system/core/libacc/acc.cpp:4611: error: cast from ‘char*’ to ‘int’ loses precision
system/core/libacc/acc.cpp: In member function ‘void acc::Compiler::unary()’:
system/core/libacc/acc.cpp:4691: error: cast from ‘char*’ to ‘int’ loses precision
system/core/libacc/acc.cpp:4697: error: cast from ‘char*’ to ‘int’ loses precision
system/core/libacc/acc.cpp:4785: error: cast from ‘void*’ to ‘int’ loses precision
system/core/libacc/acc.cpp: In member function ‘void acc::Compiler::globalDeclarations()’:
system/core/libacc/acc.cpp:5904: error: cast from ‘void*’ to ‘int’ loses precision
make: *** [out/host/darwin-x86/obj/STATIC_LIBRARIES/libacc_intermediates/acc.o] Error 1

replace cast from int to size_t in these lines


* After all these steps I was able to built the whole tree fine.

The fix for the last problem I found on:
http://wisevishvesh.wordpress.com/2010/04/12/building-eclair-on-snow-leopard/

* And here is some more of useful information I found on that blog:
Creating and Extracting files from System Image
There are two executable that are needed for creating system image and for extracting the files from the system image. mkyaffs2image is for creating and unyaffs is for extracting files. mkyaffs2image is created when Android is built, We have to build unyaffs separately.
The source unyaffs for is available here
Compile the file
gcc -o unyaffs unyaffs.c”


Hope you find this post helpful.

Good Luck!

Thursday, August 19, 2010

Monday, March 22, 2010

Wednesday, March 03, 2010

2-3 USA-Canada hockey final at Vancouver Olympics 2010

Last Sunday I was watching the hockey final game of Olympics between US and Canada. It was pretty emotional. When the US team scored a goal on the last minute of the 3rd period making the score 2-2, I yelled: "Goooaaal !!!".
The funniest part was when my little boy, seeing all this excitement around, yelled after me: "Goooaaal!"

Sunday, February 14, 2010

Intersting TED talk: Dan Gilbert asks, Why are we happy?

Stumbled upon interesting TED talk:
http://www.ted.com/talks/dan_gilbert_asks_why_are_we_happy.html

"...natural happiness is what we get when we get what we wanted
and the synthetic happiness is what we make when we don't get what we wanted

In our society we have a strong believe that a synthetic happiness is one of the inferior kind... why do we have that belief?....well it is very simple
.... what kind of economic engine would keep turning
if we believed that not getting what we want could make us
just as happy as getting it ....
a shopping mall full of zen monks is not going to be particularly
profitable because they don't want stuff enough to make it profitable ...."

"...our longings and our worries are both to some degree overblown because we
have within us the capacity to manufacture the very commodity (happiness) we are
constantly chasing when we choose experience"


"Happiness is not a state to arrive at, but a manner of traveling."
~Margaret Lee Runbeck

Saturday, January 09, 2010

Enjoyed being at the meeting with Saul Hansell

He recently came over from NYT to work for our company.
I really enjoyed the energy and passion that he has as well as the vision for the future of our product. Hope he will not get burned out too soon and will have enough leverage to implement his vision.

Following him now here http://saulhansell.blogspot.com.