Mac下获取最新AndroidSDK
package com.test; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Calendar; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; public class Android { public static void main(String[] args) { try { DefaultHttpClient client = new DefaultHttpClient(); Calendar calendar = Calendar.getInstance(); while (true) { SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); String date = format.format(calendar.getTime()); String url = "http://dl.google.com/android/adt/adt-bundle-mac-x86_64-" + date + ".zip"; HttpGet get = new HttpGet(url); HttpResponse response = client.execute(get); int status = response.getStatusLine().getStatusCode(); System.err.println(url); System.err.println(status); if(status==200){ break; } get.abort(); calendar.add(Calendar.DAY_OF_MONTH, -1); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
相关推荐
Lzs 2020-10-23
聚合室 2020-11-16
零 2020-09-18
Justhavefun 2020-10-22
jacktangj 2020-10-14
ChaITSimpleLove 2020-10-06
Andrea0 2020-09-18
周游列国之仕子 2020-09-15
afanti 2020-09-16
88234852 2020-09-15
YClimb 2020-09-15
风雨断肠人 2020-09-04
卖口粥湛蓝的天空 2020-09-15
stulen 2020-09-15
pythonxuexi 2020-09-06
abfdada 2020-08-26
梦的天空 2020-08-25