Skip to content Skip to sidebar Skip to footer

Retrofit2 Response Null On Android Pie

On android pie i am getting null response for retrofit2 request. Same code is working on all previous android devices. i have added android:usesCleartextTraffic='true' in manifest

Solution 1:

Go to Manifest.xml in application tag. Add these two lines as given below.

android:usesCleartextTraffic="true"tools:targetApi="m


<application
           android:allowBackup="true"
           android:hardwareAccelerated="true"
           android:icon="@mipmap/ic_launcher"
           android:label="@string/app_name"
           android:roundIcon="@mipmap/ic_launcher_round"
           android:supportsRtl="true"
           android:theme="@style/AppTheme"
           android:usesCleartextTraffic="true"
           tools:targetApi="m">

I hope It will work for you.

Solution 2:

android:usesCleartextTraffic="true",tools:targetApi="m"

add these two line in your manifest inside application tag

`<application
android:allowBackup="false"tools:replace="android:allowBackup"android:icon="@mipmap/cabad_logo_new"android:label="@string/app_name"android:networkSecurityConfig="@xml/network_security_config"android:roundIcon="@mipmap/cabad_logo_new_round"android:supportsRtl="true"android:theme="@style/AppTheme"tools:targetApi="m"android:usesCleartextTraffic="true">'

Post a Comment for "Retrofit2 Response Null On Android Pie"