2014年7月27日 星期日

to be continue... Android build environment setup(ubuntu 12.04)

  1. install Ubuntu 12.04 LTS 64bit
  2. follow google's instruction:
    1. https://source.android.com/source/initializing.html
      1. install oracal JDK 6 
        1. sudo apt-get install software-properties-common
        2. sudo add-apt-repository ppa:webupd8team/java
        3. sudo apt-get update
        4.  
      2. install required packages 
        1. sudo apt-get install git gnupg flex bison gperf build-essential \ zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \ libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \ libgl1-mesa-dev g++-multilib mingw32 tofrodos \ python-markdown libxml2-utils xsltproc zlib1g-dev:i386 libglapi-mesa:i386 
        2. sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
      3.  get and setup repo
        1. mkdir ~/bin
        2. add "PATH=~/bin:$PATH" in ~/.bash then run bash again
        3. curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
        4. chmod a+x ~/bin/repo
      4. download source code
        1. create new directory for download project, then switch to that directory
        2. repo init -u https://android.googlesource.com/platform/manifest
        3. repo sync -j10
      5. setup ccache (compiler cache, for speedup build time)
        1. add "export USE_CCACHE=1" in ~/.bashrc 
        2. run "prebuilts/misc/linux-x86/ccache/ccache -M 50G" in your project

2014年7月5日 星期六

android 廣告阻擋原理

android 底層是linux kernel

在linux 上面,系統要做domain name->IP的查找時,會先去檢查/etc/hosts裡面是否有寫靜態的對應,如果沒有才會真正去做DNS。

故要阻擋廣告,只要有一份廣告網址的列表,將其加到/etc/hosts內,並對應至127.0.0.1(localhost) 即可