Saturday, November 15, 2008

Good start to port 3-party to Android

After you have the open source Android, look into folder external/openssl/README.android. It is a good start to port application to Android.

Friday, November 14, 2008

Add a new component into open source Android

The android build system is complicated. It is not easy to create a simple build script to build single component. But it is much easier to add a new component into the build system. Here is a sample to build the "Hello world!" for Android, and it is dynamic linked executable.
  1. create a directory for the new component in $(YOUR_ANDROID)/external folder: $(YOUR_ANDROID)/external/hello
  2. put the hello.c into the directory: $(YOUR_ANDROID)/external/hello/
  3. create Android.mk in $(YOUR_ANDROID)/external/hello/ directory, the Android.mk likes the following:
    LOCAL_PATH:=$(call my-dir)
    include $(CLEAR_VARS)
    LOCAL_ARM_MODE := arm
    LOCAL_SRC_FILES:= \
    hello.c
    LOCAL_MODULE := hello
    include $(BUILD_EXECUTABLE)
  4. add the following line into $(BUILD_SYSTEM)/main.mk,$(BUILD_SYSTEM) is in $(YOUR_ANDROID)/build/core:
    external/hello
  5. launch the build command in $(YOUR_ANDROID): make hello
you will have the build target hello in $(YOUR_ANDROID)/out/target/product/generic/system/bin.
You can use include $(BUILD_SHARED_LIBRARY) to create shared library. Find more in $(YOUR_ANDROID)/build/core/config.mk.

Wednesday, November 12, 2008

build open source android

Refer to Get Source (Android Open Source Project) to get a copy of android open source and make full build. I had a successful build.
The android build system is quite complicated. To make a specific component, run 'make module_name'. Find the module_name in Android.mk, referenced by LOCAL_MODULE. For example, make app_process will build the app_process only.

Friday, October 24, 2008

repo the android opensource via proxy

If you are using proxy, you will get error when run: "repo init -u git://android.git.kernel.org/platform/manifest.git".
Here is a tip to repo via proxy.
To use GIT behind a proxy, have a look at:
http://www.aptgetupdate.de/2007/07/27/git-hinterm-proxy-nutzen/

Basically the steps are:
1 - sudo apt-get install socket
2 - in your home directory, put a shell script called "proxy-cmd.sh"
containing (replace YOUR_PROXY and YOUR_PROXY_PORT with your own proxy
parameters):
#! /bin/bash
(echo "CONNECT $1:$2 HTTP/1.0"; echo; cat ) | socket YOUR_PROXY
YOUR_PROXY_PORT | (read a; read a; cat )
3 - chmod +x proxy-cmd.sh
4 - export GIT_PROXY_COMMAND=/proxy-cmd.sh

Wednesday, October 22, 2008

Android 1.0 drawable tables within android.jar

Android 1.0 drawables shows the images/icons within the android.jar.

You can use any of these images/icons with your Android app, the same way you would with your own "drawables," by simple referencing the correct name in the "android.R.drawable" package, for example:
myMenuItem.setIcon(android.R.drawable.ic_menu_save);

Tuesday, October 21, 2008

Google Android Native libc Bionic library

Google developed a custom library for the C compiler (libc) called Bionic. This was necessary for three main reasons:
  • License: they wanted to keep GPL out of user-space. Bionic code uses the BSD license.
  • Size: the library has to be loaded in each process, so it needs to be small. Bionic is about 200K, or half the size of glibc (the GNU version of libc).
  • Speed: limited CPU power means it needs to be fast. Bionic has a small size and fast code paths, including a very fast and small custom pthread implementation.
Bionic has built-in support for important Android-specific services such as system properties and logging. It doesn’t support certain POSIX features, like C++ exceptions and wide chars, which were not needed on Android. Thus it’s not quite compatible with the gnu libc. All native code must be compiled against bionic, not glibc.

Google Android gets open

Google's open source android now actually open, go to http://source.android.com/download to have a downloading.