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!
-
1https://stackoverflow.com/questions/53984725/networksecurityconfig-no-network-security-config-specified-using-platform-defa/53984915#53984915 – Quick learner Jul 27 '20 at 06:47
8 Answers
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"

- 1,108
- 10
- 10
-
1Take in consideration the following: Attribute usesCleartextTraffic is only used in API level 23 and higher (current min is 21) – Nelson Sep 18 '20 at 04:54
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.

- 457
- 5
- 7
I have a same problem, with volley, but this is my solution:
In Android Manifiest, in tag application add:
android:usesCleartextTraffic="true" android:networkSecurityConfig="@xml/network_security_config"
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>
inside tag application add this tag:
<uses-library android:name="org.apache.http.legacy" android:required="false"/>

- 36,322
- 27
- 84
- 93

- 403
- 3
- 6
-
-
trying your solution, one obvious configuration, the xml of network security must be compile as Android Resource (in properties) – netadictos Apr 14 '21 at 08:55
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);
}

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

- 328
- 2
- 7
-
1Read this https://stackoverflow.com/questions/41365334/networksecurityconfig-no-network-security-config-specified-android-7-0-error/41365406#41365406 – Balraj Dec 20 '17 at 04:28
Image is vivid.
file network_security_config.xml
file manifest
to copy & paste is easy
copy xml & key line in manifest

- 9,343
- 4
- 62
- 60

- 3,643
- 24
- 25
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.
Create an XML file
Add the following code on the new XML file you created
Add this on AndroidManifest.xml

- 3,666
- 9
- 25
- 39

- 405
- 5
- 9
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

- 1
-
1I believe you meant `background thread`. Even so, the answer will still be incorrect as it should throw an NetworkOnMainThread exception. But that's not the case. I believe the issue Yeo mentioned mostly happens when requesting resources from non-SSL sources, i.e: http vs https. And for security reasons, a certain configuration is required (The Network Config) that determines which domains to trust or you can opt to allow clear text traffic which might be disabled by default for some levels of API. If you want to know more about Networking on Android, please refer to the official docs. Thanks – Gratien Asimbahwe May 05 '21 at 03:56