Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialmatt thomas
1,138 Pointsgetting 200, but error log says that I have no internet permission
I'm getting a 200 response code, so it appears to be working, but looking earlier in logcat, I am still getting:
"Exception caught: java.lang.SecurityException: Permission denied (missing INTERNET permission?)"
Why is this? Shouldn't this mean I don't get the 200?
I am in Android Studio, and I added
<uses-permission android:name="android.permission.INTERNET"/>
to my AndroidManifest.xml, inside of manifest tags, but outside of everything else.
I also noticed that my AndroidManifest.xml is missing a couple of lines that are present in the video, but now that I have this "ask question" window open I can't look at the video to report what those lines are...
I also note at the top of the log that I get 34 versions of:
"10-20 22:51:57.693 1969-1969/com.example.myname.blogreader W/dalvikvmοΉ PR_CAPBSET_DROP 0 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled."
with the number "0" in the above line incremented each of the 34 times it appears
Some one here:
http://stackoverflow.com/questions/23257462/android-hello-world-qt-5-2-avd
has exactly the same problem (with 34 repetitions too), but no solution
I did leave this tutorial series in the middle for a week or so, and when I came back to it, I thought I had picked it up again in the same place, but its possible I missed something, but I can't see what.
Does anyone have any ideas as to what is going on?
2 Answers
Marcos Santiago
1,573 PointsI was also getting "Exception caught: java.lang.SecurityException: Permission denied (missing INTERNET permission?)" even though I knew my code was correct.
What I did was closed my virtual device, downloaded updates from the SDK manager, and restarted my virtual device. The log stopped showing that an exception was being thrown (tip: you can clear logcat by right clicking>clear all).
I'm not sure what exactly fixed it, but check to see if simply restarting Android Studio and your virtual device fixes things. If not, check to see if there are any updates for you environment through the SDK manager, and then if that still doesn't work you can try reinstalling items (not sure which).
Chris Wolchesky
12,025 PointsThe error seems to suggest that you're missing the proper permissions tags in your AndroidManifest.xml file. You need to be sure to add the following BEFORE your <Application> tag:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
matt thomas
1,138 PointsThanks for the reply Chris.
I already had the first of your two lines, so I added the second, and it has made no difference to anything.
I have them inserted in AndroidManifest.xml, between the manifest tags,and before the application tag
You used the word BEFORE in capitals, but I'm not sure what it was that you were referring to that you want me to put it before?
thanks
ps. I just noticed that if you put something in angled brackets in these comments it doesn't show up in the answer. Perhaps this happened in your answer?
Chris Wolchesky
12,025 PointsI did indeed make that mistake, I was saying it has to be before the <application>
tag. Since you have the correct permissions added, maybe you just need to clean and rebuild the project?
matt thomas
1,138 PointsYes, I've tried that too, with no change
I do wonder if it has anything to do with the other part of my question, and the log message I am getting 34 times
Chris Wolchesky
12,025 PointsAccording to StackOverflow that might just mean you need to reinstall your SDK.
matt thomas
1,138 PointsSo I reinstalled (I deleted them, and redownloaded, it didn't let me delete one for some reason), and it has fixed the error saying I don't have permission, but it hasn't fixed the message that I get 34 times (which was the one that I thought it might fix!)
Fernando Tancini
6,386 PointsFernando Tancini
6,386 PointsThanks! It worked for me. I just restarted Android Studio and my virtual device.