2011년 12월 6일 화요일

How to use Android 4.0 ICS sdk manager on linux behind firewall

I am not 100% sure if there is other ways to use sdk manager on linux for ICS sdk manager.
My tips are:

pre-condition : suppose you have source code of ICS

1. Modify 'sdk/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SettingsController.java'
- In 'getForceHttp' method,
return true;
//return Boolean.parseBoolean(mProperties.getProperty(ISettingsPage.KEY_FORCE_HTTP));

2. 'sdk/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/UrlOpener.java'
- In 'openWithHttpClient' method
add 2 lines of import..

import org.apache.http.conn.params.ConnRoutePNames;
import org.apache.http.HttpHost;

and modify like below

// use the simple one
final DefaultHttpClient httpClient = new DefaultHttpClient();

// newly added
HttpHost proxy = new HttpHost("{proxy address}", {proxy port});
httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);

2011년 12월 5일 월요일

Get Android 4.0 ICS source code behind firewall

I've just pulled Android 4.0 ICS source code by using repo shell command behind firewall.
What I've done are:
1. In home directory
$ mkdir bin # create bin directory as Android recommends
$ vi .bashrc # add bin directory to PATH environment
2. Add below line to .bashrc file
export PATH=/home/{user_name}/bin:$PATH
3. Save and adapt changes
$ source .bashrc
4. Get repo shell
# install curl if you don't have it by using synaptic package installer or apt-get ...
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo
> ~/bin/repo --proxy {proxy_ip}:{proxy_port}
$ chmod a+x ~/bin/repo # add executable attribute to shell file
5. Create working directory and move into it
$ mkdir Android && cd Android
6. export http_proxy attribute
$ export http_proxy={proxy_ip}:{proxy_port}
7. Init repo branch
$ repo init -u https://android.googlesource.com/platform/manifest # for checking out other branches see android developer page
8. Finally you can get the source code
$ repo sync

Enjoy ICS!