Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

[Solved] Add Internet Permission in AndroidManifest.xml in Android studio

In this tutorial, I will be sharing how to add internet permission in Android studio. When you are working on app that wants to access internet and facing the below warning/issue in LogCat.

java.net.SocketException: Permission denied (maybe missing INTERNET permission)

Solution


In order to access the internet in your app, add the below line in your AndroidManifest.xml that will solve the internet permission.

android:name="android.permission.INTERNET" />


Please paste the above line before the tag otherwise it will give warning.

Note: The permission name is case-sensitive i.e wrong case means your application does not get the internet permission.


WRONG
android:name="ANDROID.PERMISSION.INTERNET" />


STEPS:

1. Follow the below steps. Go to  app -> src -> main -> AndroidManifest.xml

2. Add the following line in AndroidManifest.xml before tag.


android:name="android.permission.INTERNET" />


3. Your AndroidManifest.xml file should look like this:

xlmns:android="http://schemas.android.com/apk/res/android"
package="com.javahungry.helloworldapp">

...

android:name="android.permission.INTERNET" />


...




That's it. After performing the above steps you will be able to access the internet in the app. Please let me know in the comments in case you have any questions related to how to add internet permission in AndroidManifest.xml in Android Studio.


This post first appeared on Java Hungry, please read the originial post: here

Share the post

[Solved] Add Internet Permission in AndroidManifest.xml in Android studio

×

Subscribe to Java Hungry

Get updates delivered right to your inbox!

Thank you for your subscription

×