将build.gradle从15更新为minSdkVersion android到16后,开始获取:

Could not download gson.jar (com.google.code.gson:gson:2.8.0)

这是我完整的模块build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'jacoco'

jacoco {
toolVersion "0.7.4+"
}

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'

defaultConfig {
    applicationId "com.android.mock"
    minSdkVersion 16
    targetSdkVersion 28
    versionCode 1
    versionName "20.1.3"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    missingDimensionStrategy 'default', 'mock'

}
useLibrary 'org.apache.http.legacy'
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    debug{
        testCoverageEnabled false
    }
}
lintOptions {
    abortOnError false
}
flavorDimensions "fourth"
productFlavors {
    prod {
        dimension "fourth"
    }
    dev {
        dimension "fourth"
    }
    mock {
        dimension "fourth"
    }
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'

//Test Dependencies
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'

androidTestImplementation group:'org.bouncycastle',name:'bcprov-jdk15on',version:'1.56'
androidTestImplementation group:'org.bouncycastle',name:'bcpkix-jdk15on',version: '1.56'
//api(group:'com.android', name:'mytestlib', version: '1.0') //from published
implementation project(':mytestlib')
api 'org.awaitility:awaitility:3.1.6'
implementation 'com.squareup.okhttp3:mockwebserver:3.8.1'

implementation 'com.readystatesoftware.chuck:library:1.1.0'

//for retrofit testing
androidTestImplementation 'com.squareup.retrofit:retrofit:1.6.1'
androidTestImplementation 'com.squareup.picasso:picasso:2.5.2'
androidTestImplementation 'com.squareup.retrofit2:retrofit:2.3.0'
androidTestImplementation 'com.squareup.retrofit2:converter-gson:2.3.0'
}

apply plugin: 'com.google.gms.google-services'