Faced the following problem:
you need to parse data from a JSON file located at a specific link. For this I use the org.json. * Classes. To access the Internet connection in AndroidManifest, I specify the following:
& lt; uses-permission android: name = "android.permission.INTERNET" / & gt;
& lt; uses-permission android: name = "android.permission.ACCESS_WIFI_STATE" / & gt;
& lt; uses-permission android: name = "android.permission.ACCESS_NETWORK_STATE" / & gt;
But when I run the application on Android 6, I get the following exception:
Permission denied (missing INTERNET permission?)
I read about Runtime Permissions in the Android docs and realized that perhaps the problem lies in the fact that android.permission.INTERNET is a dangerous permission and you will have to add a couple of methods to request permission during program execution.
But googling came across this article from habra , which states that access to the Internet is not dangerous.
So what’s the problem then?
upd: AndroidManifest.xml file
& lt;? xml version = "1.0" encoding = "utf-8"? & gt;
& lt; manifest xmlns: android = "http://schemas.android.com/apk/res/android"
package = "ru.cargomart.cargomart" & gt;
& lt; uses-permission android: name = "android.permission.INTERNET" / & gt;
& lt; uses-permission android: name = "android.permission.ACCESS_WIFI_STATE" / & gt;
& lt; uses-permission android: name = "android.permission.ACCESS_NETWORK_STATE" / & gt;
& lt; application
android: allowBackup = "true"
android: icon = "@ mipmap / ic_launcher"
android: label = "@ string / app_name"
android: theme = "@ style / AppTheme" & gt;
& lt; activity
android: name = ". MainActivity"
android: label = "@ string / app_name"
android: theme = "@ style / AppTheme.NoActionBar" & gt;
& lt; intent-filter & gt;
& lt; action android: name = "android.intent.action.MAIN" / & gt;
& lt; category android: name = "android.intent.category.LAUNCHER" / & gt;
& lt; / intent-filter & gt;
& lt; / activity & gt;
& lt; / application & gt;
& lt; / manifest & gt;
Answer 1, authority 100%
Hmm … is Android Studio itself, sdk, build tools all fresh?
A similar problem was recognized here 3 years ago, https://www.parse.com / questions / android-sdk-parseasynctask-runtimeexception , but promised to fix it in future versions of sdk. Maybe a relapse. Try to write to them. And by the way, it would be nice to see a piece of code that you have associated with the Internet connection, although I doubt that we will learn something useful from there, and your build.gradle …