Retrofit ошибка получения данных от сервера на Android 10

Разработал простейшее android-приложение для получения прогноза погоды. Для взаимодействия с сервером (openweather api) использовал retrofit. На смартфоне с android 7 приложение работает без проблем. На android 10 приложение запускается, но при получении ответа от сервера всегда возникает ошибка и вызывается метод onFailure интерфейса Callback. Вот код (не думаю, что проблема где-то здесь, т.к. на смартфоне с android 7 этот код работает нормально):

public void getWeather(){
        String url = "weather?APPID=a9c23a4b5e461f2d05d4b4b540a0e6ad&lat="+this.mLatitude+"&lon="+this.mLongitude;
        String url1 = "forecast?APPID=a9c23a4b5e461f2d05d4b4b540a0e6ad&lat="+this.mLatitude+"&lon="+this.mLongitude;
        WeatherApiService.getInstance()
                .getOpenWeatherApi()
                .getWeatherForCoordinates(url)
                .enqueue(new Callback<CurrentWeatherResponse>() {
                    @Override
                    public void onResponse(@NonNull Call<CurrentWeatherResponse> call, @NonNull retrofit2.Response<CurrentWeatherResponse> response) {
                        CurrentWeatherResponse response1= response.body();
                        CurrentWeatherResponseParser parser = new CurrentWeatherResponseParser(response1);
                        parser.doParse();
                        Gson gson = new Gson();
                        String responseToString = gson.toJson(response1, CurrentWeatherResponse.class);
                        ContentValues cv = new ContentValues();
                        cv.put("rString",responseToString);
                        Main2Activity.sCurrentDatabase.execSQL("delete from str");
                        Main2Activity.sCurrentDatabase.insert("str", null, cv);
                    }

                    @Override
                    public void onFailure(@NonNull Call<CurrentWeatherResponse> call, @NonNull Throwable t) {
                        Toast.makeText(CurrentWeatherFragment.sContext, "Data receiving error", Toast.LENGTH_LONG).show();
                    }
                });

        WeatherApiService.getInstance()
                .getOpenWeatherApi()
                .getForecastForCoordinates(url1)
                .enqueue(new Callback<ForecastResponse>() {
                    @Override
                    public void onResponse(@NonNull Call<ForecastResponse> call, @NonNull retrofit2.Response<ForecastResponse> response) {
                        ForecastResponse response1= response.body();
                        ForecastResponseParser parser = new ForecastResponseParser(response1);
                        parser.doParse();
                        Gson gson = new Gson();
                        String responseToString = gson.toJson(response1, ForecastResponse.class);
                        ContentValues cv = new ContentValues();
                        cv.put("rString",responseToString);
                        Main2Activity.sForecastDatabase.execSQL("delete from str");
                        Main2Activity.sForecastDatabase.insert("str", null, cv);
                    }

                    @Override
                    public void onFailure(@NonNull Call<ForecastResponse> call, @NonNull Throwable t) {
//                        Toast.makeText(CurrentWeatherFragment.sContext, "Data receiving error", Toast.LENGTH_LONG).show();
                    }
                });
    }

Предполагаю, что проблема где-то в build.gradle-файле. Возможно в блоке compileOptions без которого приложение не собирается:

compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }

Вот код build.gradle целиком:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
    defaultConfig {
        applicationId "com.nucldev.simpleweatherlocator"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.navigation:navigation-fragment:2.0.0'
    implementation 'androidx.navigation:navigation-ui:2.0.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    implementation group: 'com.google.android.gms', name: 'play-services-location', version: '17.0.0'
    implementation group: 'com.google.android.gms', name: 'play-services-tasks', version: '17.0.0'
    implementation 'com.squareup.retrofit2:retrofit:2.7.1'
    implementation 'com.squareup.retrofit2:converter-gson:2.7.0'
}

Ответы (0 шт):