In my application i want get data from server, for get connect to server i used Retrofit, OkHttp.
But when running application, show me
Here I solve that problem downgrading this dependencies to this versions
api 'com.squareup.retrofit2:retrofit:2.3.0'
api 'com.squareup.retrofit2:converter-gson:2.3.0'
api 'com.squareup.okhttp3:okhttp:3.8.0'
And adding this code into onCreate of MainActivity
try {
ProviderInstaller.installIfNeeded(this);
} catch (GooglePlayServicesRepairableException e) {
// Indicates that Google Play services is out of date, disabled, etc.
// Prompt the user to install/update/enable Google Play services.
GoogleApiAvailability.getInstance()
.showErrorNotification(this, e.getConnectionStatusCode());
} catch (GooglePlayServicesNotAvailableException e) {
// Indicates a non-recoverable error; the ProviderInstaller is not able
// to install an up-to-date Provider.
}
Downgrade dependencies is neet because newest version need android API 21 or later.
That code above is to android update your security provider to protect against SSL exploits. See https://developer.android.com/training/articles/security-gms-provider.html to know more about it.