|
23 | 23 | import java.beans.PropertyChangeEvent; |
24 | 24 | import java.beans.PropertyChangeListener; |
25 | 25 | import java.io.*; |
| 26 | +import java.net.MalformedURLException; |
26 | 27 | import java.net.URL; |
27 | 28 | import java.net.URLConnection; |
28 | 29 | import java.util.Enumeration; |
|
32 | 33 | @SuppressWarnings("serial") |
33 | 34 | public class SDKDownloader extends JFrame implements PropertyChangeListener { |
34 | 35 |
|
35 | | - private static final String URL_REPOSITORY = "https://dl-ssl.google.com/android/repository/repository-10.xml"; |
| 36 | + private static final String URL_REPOSITORY = "https://dl-ssl.google.com/android/repository/repository-11.xml"; |
36 | 37 | private static final String URL_REPOSITORY_FOLDER = "http://dl-ssl.google.com/android/repository/"; |
37 | 38 | private static final String URL_USB_DRIVER = "https://dl-ssl.google.com//android/repository/latest_usb_driver_windows.zip"; |
38 | 39 |
|
@@ -135,7 +136,19 @@ protected void done() { |
135 | 136 |
|
136 | 137 | private void downloadAndUnpack(String urlString, File saveTo, |
137 | 138 | File unpackTo) throws IOException { |
138 | | - URL url = new URL(urlString); |
| 139 | + URL url = null; |
| 140 | + try { |
| 141 | + url = new URL(urlString); |
| 142 | + } catch (MalformedURLException e) { |
| 143 | + //This is expected for API level 14 and more |
| 144 | + try { |
| 145 | + url = new URL(URL_REPOSITORY_FOLDER + urlString); |
| 146 | + } catch (MalformedURLException e1) { |
| 147 | + //This exception is not expected. Need to return. |
| 148 | + e1.printStackTrace(); |
| 149 | + return; |
| 150 | + } |
| 151 | + } |
139 | 152 | URLConnection conn = url.openConnection(); |
140 | 153 |
|
141 | 154 | InputStream inputStream = conn.getInputStream(); |
|
0 commit comments