org apache http legacy android 9

Solutions on MaxInterview for org apache http legacy android 9 by the best coders in the world

showing results for - "org apache http legacy android 9"
Diamond
07 Feb 2019
1To run org.apache.http.legacy perfectely in Android 9.0 Pie create an xml file res/xml/network_security_config.xml
2
3<?xml version="1.0" encoding="utf-8"?>
4    <network-security-config>
5      <base-config cleartextTrafficPermitted="true">
6       <trust-anchors>
7        <certificates src="system" />
8       </trust-anchors>
9      </base-config>
10    </network-security-config>
11And add 2 tags tag in your AndroidManifest.xml
12
13android:networkSecurityConfig="@xml/network_security_config" android:name="org.apache.http.legacy"
14
15<?xml version="1.0" encoding="utf-8"?>
16 <manifest......>
17  <application android:networkSecurityConfig="@xml/network_security_config">
18   <activity..../> 
19   ......
20   ......
21 <uses-library
22        android:name="org.apache.http.legacy"
23        android:required="false"/>
24</application>
25Also add useLibrary 'org.apache.http.legacy' in your app build gradle
26
27android {
28compileSdkVersion 28
29defaultConfig {
30    applicationId "your application id"
31    minSdkVersion 15
32    targetSdkVersion 28
33    versionCode 1
34    versionName "1.0"
35    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
36    useLibrary 'org.apache.http.legacy'
37}
38