No Network Security Config specified, using platform default - Android Log

Android

Android Problem Overview


I am trying to make a database via 000webhost.com. I keep getting this message showing in the event log whenever I run the app from android studio. Does anyone knows how to solve this problem? Much appreciated!

Android Solutions


Solution 1 - Android

I had also the same problem. Please add this line in application tag in manifest. I hope it will also help you.

android:usesCleartextTraffic="true"

Solution 2 - Android

The message you're getting isn't an error; it's just letting you know that you're not using a Network Security Configuration. If you want to add one, take a look at this page on the Android Developers website: https://developer.android.com/training/articles/security-config.html.

Solution 3 - Android

I have a same problem, with volley, but this is my solution:

  1. In Android Manifiest, in tag application add:

     android:usesCleartextTraffic="true"
     android:networkSecurityConfig="@xml/network_security_config"
    
  2. create in folder xml this file network_security_config.xml and write this:

     <?xml version="1.0" encoding="utf-8"?>
       <network-security-config>
         <base-config cleartextTrafficPermitted="true" />
       </network-security-config>
    
  3. inside tag application add this tag:

     <uses-library android:name="org.apache.http.legacy" android:required="false"/>
    

Solution 4 - Android

I just had the same problem. It is not a network permission but rather thread issue. Below code helped me to solve it. Put is in main activity

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    if (android.os.Build.VERSION.SDK_INT > 9)
    {
        StrictMode.ThreadPolicy policy = new 
        StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
    }

Solution 5 - Android

Check the URL it should be using https rather than http protocol.
In my case changing http to https in the URL solved it.

Solution 6 - Android

Image is vivid.

file network_security_config.xml

111

file manifest

888


to copy & paste is easy

relevant file in github

copy xml & key line in manifest

Solution 7 - Android

This occurs to the api 28 and above, because doesn't accept http anymore, you need to change if you want to accept http or localhost requests.

  1. Create an XML file Create XML file

  2. Add the following code on the new XML file you created Add base-config

  3. Add this on AndroidManifest.xml Add this code line

Solution 8 - Android

I know i'm late for the answer, but it might help someone. If you still having this problem, you probably didn't put the method , that makes the request, in a Thread

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionyeoView Question on Stackoverflow
Solution 1 - Androidpaul polashView Answer on Stackoverflow
Solution 2 - Androiduser6939352View Answer on Stackoverflow
Solution 3 - AndroidCarlos Ivan OlvidaosView Answer on Stackoverflow
Solution 4 - AndroidJames NormanView Answer on Stackoverflow
Solution 5 - AndroidBalrajView Answer on Stackoverflow
Solution 6 - AndroiddengST30View Answer on Stackoverflow
Solution 7 - AndroidhectorromerodevView Answer on Stackoverflow
Solution 8 - AndroidlorikView Answer on Stackoverflow