リモートtxtファイルを取得しようとするとアプリがクラッシュします。URLを解析しようとしても、クラッシュします。インターネット許可が設定され、デバイス/仮想マシンがインターネットに接続しています。
LogCat:
コードスニペット:
try {
// the following line is enough to crash the app
URL url = new URL("http://www.i.am/not/going/to/show/you/this.txt");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String line = null;
while ((line = in.readLine()) != null) {
//get lines
}
in.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
私は自分が間違っていることを理解していません。事前に助けてくれてありがとう。
//編集:ログ猫スニペットを追加