Android学习笔记 - Android平台源代码下载以及编译

    技术2022-05-13  15

     

    I tried to analyse  source code of Android Applications, but that's really boring me.

     

    I tried to write some applications for Android, but I am not familar with JAVA.

     

    I tried to compile FLTK source code for Android platform, but FLTK needs a lot of other libraries. It's a little bit troublesome.

     

    At last, I decide to compile whole Android platform under uBuntu, then I could analyse Android source code. I think that would be interesting.

     

     

     

    Actually, I hate such huge project, it always make development deep into countless troubles.

    I think that's why G-phones are not as successfull  as iphone. Hope one day this situation will change.

     

    OK, Let's kick off:

     

    1. Install libs

    $ sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl li b ncurses5-dev zlib1g-dev

    2. 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

     

     

    If you don't have ubuntu, http://source.android.com/download could help you setup your system.

     

    3. download the project

    repo init -u git://android.git.kernel.org/platform/manifest.git

    (At first, I supposed this command will download whole project files. After did that, I just found a hidden folder in my Android fold, that let me down. And I searched a lot of Chinese website, no one tells me that's why. Actually it's easy...)

    4. download project files

    repo sync

    (Go to bed, enjoy anything you want, after that...)

     

    You will find everything is done.

     

    5 Build the project

    Get into your working fold, just "make"

    if some problems occurs, try  "export ANDROID_JAVA_HOME=$JAVA_HOME"

    (Go to bed, enjoy anything you want, after that...)

     

    You will find everything is mess ^_^, maybe you will find various errors according to your operation system's environment.

    You should handle it by yourself. I will give you my blessing.

     

    The enclosed issues maybe you would meet:

    1. Can't build "assert ", just mask it.

    2. JDK version. It seems jdk1.5 is supported. You can add a line in ~/.bashrc: export PATH=java_bin_path:PATH

     

     

     

    As a new source code management tool, you should spend a few time to study it.

    http://source.android.com/download/using-repo will give you information.

     

     


    最新回复(0)