Why do I have to remove
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
to make
<uses-permission android:name="android.permission.INTERNET" />
work?
If I leave both I get an exception when using a function that tries to get access to the web.
Since you’ve refrained from giving us a stack trace, I’m giving this answer with a bit of guessing.
My guess is you’re getting a
NetworkOnMainThreadException. This exception occurs on Android 3.0 and above, when you try to use the network on the main UI thread. when you add the<uses-sdk>tag to your app, you build your app against API 16, which is higher than Honeycomb. This also explains why you don’t see the exception on Gingerbread.To fix this, move all networking code into a Thread or an AsyncTask.