I am still fumbling through Android, today, in trying to create an AsyncTask to connect to a website, post some data, and get a response. My understanding is that i must use an AsyncTask here, as the main thread is not allowed to do this sort of work. And, iiuc, AsyncTask threads are not available for debugging with the Studio debugger.
The log shows "1" then "exception," as it fails on connection.getOutputStream(). I have verified it is that specific method by splitting up the statement, and setting connection.getOutputStream() to an interim variable in it's own line of code.
Why didn't i think of that? I feel kind of silly now. I had forgotten to remove my filter, thus i never saw when it said: java.lang.SecurityException: Permission denied (missing INTERNET permission?)
I did have the following line in AndroidManifest.xml: <uses-permission android:name="INTERNET"/>
But, a simple search found that should have been: <uses-permission android:name="android.permission.INTERNET"/>
It also says i need i also needed: <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>, but we'll wait and see on that one. Right now i have a different bug to work out.