1

I am changing my sdk version(on android studio) compileSdkVersion to 29 and taregtSdkversion to 29 as 27 is no more supported and throwing error while uploading in play store, as when it is changed the internet which the app is using is not working

what to do when you change sdk version from 27 to 29 and when i do so the internet which the app is using is not working and it shows offline and when i change it back to 27 then it works fine how to fix as i need to change it to 29 in order to upload it into play store.

android{
compileSdkVersion 27
defaultCofig{
applicationId"com.abc.news"
minSdkversion 15

targetSdkVersion 27
versionCode 14
versionname"1.0"
}

How to enable the internet when changing api level to 29 as its not working when I changed it to 29 and I have included the internet permission and network state permission also

Manohar
  • 22,116
  • 9
  • 108
  • 144
  • are you testing in pie os – Ankit Sep 11 '19 at 11:14
  • 1
    I think you are using http urls add `android:usesCleartextTraffic="true"` inside application tag `of AndroidManifest.xml` – Manohar Sep 11 '19 at 11:16
  • you may be getting error because your url is not https. do check that. – Sagar Nayak Sep 11 '19 at 11:21
  • yes now the internet is working but its not showing any text that i have pushed from the admin panel to the front end of the app and this code is working for me android:usesCleartextTraffic="true" – sital sharma Sep 11 '19 at 11:44
  • https://stackoverflow.com/questions/53984725/networksecurityconfig-no-network-security-config-specified-using-platform-defa/53984915#53984915 – Quick learner Sep 11 '19 at 12:52

2 Answers2

1

Do you have this in your manifest?

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Tomaz Mazej
  • 465
  • 5
  • 19
0

You should create res folder for xml files in res folder and create in thats file for configs.

network_security_config.xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
        </trust-anchors>
    </base-config>
</network-security-config>

And in the end in AndroidManifest file in application tag add this line.

android:networkSecurityConfig="@xml/network_security_config"