我正在請求以下請求,並且我在android應用程序中遇到異常。許可在拒絕HTTP請求時被拒絕
URL url = new URL(strURL);
URLConnection urlConnection = url.openConnection();
try {
HttpURLConnection httpConn = (HttpURLConnection) urlConnection;
httpConn.setRequestMethod("GET");
httpConn.connect();
if (httpConn.getResponseCode() == HttpURLConnection.HTTP_OK) {
is = httpConn.getInputStream();
}
} catch (Exception ex) {
System.out.println(ex);
}
得到以下異常
java.net.SocketException: Permission denied
可能重複:http://stackoverflow.com/questions/11576339/java-net-socketexception -permission被拒絕換機器人 – EvZ