在 Android 用HttpURLConnection进行请求服务器是出现的响应码为505是,可能是在拼接链接地址时里含有空格,需将空格转码即可。 使用 str=str.replaceAll(" ", "%20");即可