2009년 4월 6일 월요일
Customized list adapter 만들기
2009년 3월 21일 토요일
Android Data Storage
2009년 3월 20일 금요일
2009년 3월 18일 수요일
Android 에서 sqlite3 사용하기
(만약, application package name 이 com.sample.app 일경우)
> sqlite3 sample.db
2009년 3월 16일 월요일
Android emulator에서 SD card 사용하기
Eclipse 에 Android Framework base code 적용하기
안드로이드 Full source 받기 (with Ubuntu)
What's in the source?
Setting up your machine
Linux
The Android build is routinely tested on recent versions of Ubuntu (6.06 and later), but reports of successes or failures on other distributions are welcome.Ubuntu Linux (32-bit x86)
=> 구글에서도 Ubuntu를 권장 하네요.
- Required Packages:
- Git 1.5.4 or newer and the GNU Privacy Guard.
- JDK 5.0, update 12 or higher. Java 6 is not supported, because of incompatibilities with @Override.
- flex, bison, gperf, libsdl-dev, libesd0-dev, libwxgtk2.6-dev (optional), build-essential, zip, curl.
$ sudo apt-get install git-core gnupg sun-java6-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev
=> 다운받기 위해서는 Git 이라는 source 관리 tool 이 필요 합니다.
위 sudo 명령어를 그래도 실행하면 Git 이 설치 됩니다. (만약, proxy를 사용할경우 proxy 설정에서 설정후 하셔야 합니다.)
- You might also want Valgrind, a tool that will help you find memory leaks, stack corruption, array bounds overflows, etc.
$ sudo apt-get install valgrind=> 이것도 설치.
- Intrepid (8.10) users may need a newer version of libreadline:
Ubuntu Linux (64-bit x86)
=> 여기서는 안해봤습니다. (하지만, 64 가지고 계신분은.. 아래 설명 그대로....)
This has not been as well tested. Please send success or failure reports to repo-discuss@googlegroups.com.- Required Packages:
- Git, JDK, flex, and the other packages as listed above in the i386 instructions:
- JDK 5.0, update 12 or higher. Java 6 is not supported, because of incompatibilities with @Override.
- Pieces from the 32-bit cross-building environment
- X11 development
$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl sun-java5-jdk zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev
- Set the system to use the right version of java by default:
$ sudo update-java-alternatives -s java-1.5.0-sun
- X11: Ubuntu doesn't have packages for the X11 libraries, but that can be worked around with the following command:
$ sudo ln -s /usr/lib32/libX11.so.6 /usr/lib32/libX11.so
Running Linux in a virtual machine
If you are running Linux in a virtual machine, you will need at least 1.5GB of RAM and 10GB or more of disk space in order to build the Android tree.Other Linux
There's no reason why Android cannot be built on non-Ubuntu systems. Please send any success or failure reports to repo-discuss@googlegroups.com. In general you will need:
- Python 2.4, which you can download from python.org .
- JDK 5.0, update 12 or higher, which you can download from java.sun.com . Java 6 is not supported, because of incompatibilities with @Override.
- Git 1.5.4 or newer. You can find it at http://git.or.cz/ .
Anything missing from this list? Please let us know!
Requirements:
- To build the Android files in a Mac OS environment, you need an Intel/x86 machine. The Android build system and tools do not support the obsolete PowerPC architecture.
- Android must be built on a case-sensitive file system.
- We recommend that you build Android on a partition that has been formatted with the "Case-sensitive Journaled HFS+" file system:
- A case-sensitive file system is required because the sources contain files that differ only in case.
- Journaled systems are more robust. (This is optional, but recommended.)
- HFS+ is required to successfully build Mac OS applications such as the Android Emulator for OS X.
- If you want to avoid partitioning/formatting your hard drive, you can use a case-sensitive disk image instead.
- To create the image:
- launch /Applications/Utilities/Disk Utility
- select "New Image"
- size: 8 GB (this will work, but you can choose more if you want to)
- volume format: case sensitive, journaled
- This will create a .dmg file which, once mounted, acts as a drive with the required formatting for Android development. For a disk image named "android.dmg" stored in your home directory, you can add the following to your ~/.bash_profile to mount the image when you execute "mountAndroid":# command to mount the android file image
function mountAndroid { hdiutil attach ~/android.dmg -mountpoint /Volumes/android; }
Once mounted, you'll do all your work in the "android" volume. You can eject it (unmount it) just like you would with an external drive.
- Install the XCode version 2.4 or later from http://developer.apple.com . We recommend version 3.0 or newer.
- Install MacPorts. To do this:
- Download the tar file from http://www.macports.org/ and untar the files.
- Run the following:
$ ./configure
$ make
$ sudo make install - Make sure that /opt/local/bin is in your path before /usr/bin. by running
$ echo $PATH
If you don't see /opt/local/bin, edit $HOME/.bash_profile and add the line
export PATH=/opt/local/bin:$PATH
(or the equivalent for other shells) after any other PATH-related lines. To verify that your path is now correct, open a new terminal and run echo $PATHagain. - Ask MacPorts to update itself:
$ sudo port selfupdate - Get the following packages from port:
$ POSIXLY_CORRECT=1 sudo port install gmake libsdl git-core gnupg - Upgrade GNU make to 3.81 or later by running. Mac OS doesn't come with a recent enough version.
$ sudo ln -s gmake /opt/local/bin/make - Set an appropriate per-process file descriptor limit. To do this, add the following lines to your .bash_profile file:
# set the number of open files to be 1024
ulimit -S -n 1024
Installing Repo
Repo is a tool that makes it easier to work with Git in the context of Android. For more information about Repo, see Using Repo and Git.
- Make sure you have a ~/bin directory in your home directory, and check to be sure that this bin directory is in your path:
$ cd ~
$ mkdir bin
$ echo $PATH - Download the repo script and make sure it is executable:
$ curl http://android.git.kernel.org/repo >~/bin/repo$ chmod a+x ~/bin/repo
=> Git을 사용할때 repo 라는 tool을 이용하여 얻고자 하는 source를 설정해주는것 같습니다.
위에서 처럼 (1 , 2 번 모두) 모두 실행합니다.
Initializing a Repo client
- Create an empty directory to hold your working files:
$ mkdir mydroid
$ cd mydroid - Run repo init to bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest:
$ repo init -u git://android.git.kernel.org/platform/manifest.git - If you would like to check out a branch other than "master", specify it with -b, like:
$ repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake - When prompted, configure Repo with your real name and email address. If you plan to submit code, use an email address that is associated with a Google account.
repo initialized in /mydroid
Your client directory should now contain a .repo directory where files such as the manifest will be kept.
What will my name and email be used for?
To use the Gerrit code-review tool, you will need an email address that is connected with a registered Google account (which does not have to be a Gmail address). Make sure this is a live address at which you can receive messages. The real name that you provide here will show up in attributions for your code submissions.
What is a manifest file?
The Android source files are divided among a number of different repositories. A manifest file contains a mapping of where the files from these repositories will be placed within your working directory when you synchronize your files.
Getting the files
$ repo sync
For more about repo sync and other Repo commands, see Using Repo and Git.
The Android source files will be located in your working directory under their project names.
Building the code
To build the files, run make from within your working directory:$ cd ~/mydroid
$ make
If your build fails, complaining about a missing "run-java-tool", try setting the ANDROID_JAVA_HOME env var to $JAVA_HOME before making. E.g.,
$ export ANDROID_JAVA_HOME=$JAVA_HOME
=> 빌드가 완료되면 out 이라는 폴더가 생성됩니다.
그중 아래와 같은 파일 3개를 얻을수 있습니다.
~mydroid/out/target/product/generic/ramdisk.img
~mydroid/out/target/product/generic/system.img
~mydroid/out/target/product/generic/userdata.img
이 파일들을 android sdk 의 image 폴더에 복사를 해두면 build 한 버전으로 emulator 를 실행할 수 있습니다.
폴더 경로는 아래와 같습니다.
android-sdk-windows-1.1_r1/tools/lib/images
Emulator 실행후 이상 없이 실행될 경우 정상적으로 build 되었다고 볼 수 있습니다.