首页 > 代码库 > Android 4.4 conn.getInputStream()抛出异常

Android 4.4 conn.getInputStream()抛出异常

HttpURLConnection conn = (HttpURLConnection) url.openConnection();
InputStream inStream = conn.getInputStream();//异常抛出

在AndroidManifest.xml文件

默认生成

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />

删除android:targetSdkVersion 并修改 android:minSdkVersion="7" 或者更低版本

<uses-sdk
android:minSdkVersion="7"/>